mirror of
https://tangled.org/tranquil.farm/tranquil-pds
synced 2026-08-16 14:26:06 +00:00
types: drop unchecked construction from validated newtypes
Lewis: May this revision serve well! <lu5a@proton.me>
This commit is contained in:
@@ -42,12 +42,6 @@ macro_rules! impl_string_common {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for $name {
|
||||
fn from(s: String) -> Self {
|
||||
Self(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a $name> for Cow<'a, str> {
|
||||
fn from(val: &'a $name) -> Self {
|
||||
Cow::Borrowed(&val.0)
|
||||
@@ -109,6 +103,12 @@ macro_rules! simple_string_newtype {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for $name {
|
||||
fn from(s: String) -> Self {
|
||||
Self(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl_string_common!($name);
|
||||
};
|
||||
}
|
||||
@@ -129,6 +129,12 @@ macro_rules! simple_string_newtype_no_sqlx {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for $name {
|
||||
fn from(s: String) -> Self {
|
||||
Self(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl_string_common!($name);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user