Trait attribute_derive::from_partial::FromPartial
source · pub trait FromPartial<T>: Sized {
// Required method
fn from(partial: T) -> Result<Self>;
// Provided methods
fn from_option(partial: Option<T>, error_missing: &str) -> Result<Self> { ... }
fn join(
first: Option<SpannedValue<T>>,
second: SpannedValue<T>,
specified_twice_error: &str,
) -> Result<Option<SpannedValue<T>>> { ... }
}
Expand description
Converts from a Partial
value.
Required Methods§
sourcefn from(partial: T) -> Result<Self>
fn from(partial: T) -> Result<Self>
Creates Self
from T
.
§Errors
Returns a syn::Error
when T
does not represent a valid Self
,
e.g., due to missing or conflicting fields.
Provided Methods§
sourcefn from_option(partial: Option<T>, error_missing: &str) -> Result<Self>
fn from_option(partial: Option<T>, error_missing: &str) -> Result<Self>
sourcefn join(
first: Option<SpannedValue<T>>,
second: SpannedValue<T>,
specified_twice_error: &str,
) -> Result<Option<SpannedValue<T>>>
fn join( first: Option<SpannedValue<T>>, second: SpannedValue<T>, specified_twice_error: &str, ) -> Result<Option<SpannedValue<T>>>
Defines how two arguments for the same parameter should be handled.
§Errors
The default implementation errors if first
is already present and
specified_twice_error
is returned with the correct spans.
Object Safety§
This trait is not object safe.