pub unsafe trait FromValue<'a>: Sized {
type Checker: ValueTypeChecker;
// Required method
unsafe fn from_value(value: &'a Value) -> Self;
}
Expand description
Required Associated Types§
Sourcetype Checker: ValueTypeChecker
type Checker: ValueTypeChecker
Value type checker.
Required Methods§
Sourceunsafe fn from_value(value: &'a Value) -> Self
unsafe fn from_value(value: &'a Value) -> Self
Get the contained value from a Value
.
§Safety
Self::Checker::check()
must be called first and must not fail.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'a> FromValue<'a> for &'a str
impl<'a> FromValue<'a> for &'a str
type Checker = GenericValueTypeOrNoneChecker<&'a str>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for &'a [GStringPtr]
impl<'a> FromValue<'a> for &'a [GStringPtr]
type Checker = GenericValueTypeChecker<&'a [GStringPtr]>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for bool
impl<'a> FromValue<'a> for bool
type Checker = GenericValueTypeChecker<bool>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for char
impl<'a> FromValue<'a> for char
type Checker = CharTypeChecker
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for f32
impl<'a> FromValue<'a> for f32
type Checker = GenericValueTypeChecker<f32>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for f64
impl<'a> FromValue<'a> for f64
type Checker = GenericValueTypeChecker<f64>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for i8
impl<'a> FromValue<'a> for i8
type Checker = GenericValueTypeChecker<i8>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for i32
impl<'a> FromValue<'a> for i32
type Checker = GenericValueTypeChecker<i32>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for i64
impl<'a> FromValue<'a> for i64
type Checker = GenericValueTypeChecker<i64>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for u8
impl<'a> FromValue<'a> for u8
type Checker = GenericValueTypeChecker<u8>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for u32
impl<'a> FromValue<'a> for u32
type Checker = GenericValueTypeChecker<u32>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for u64
impl<'a> FromValue<'a> for u64
type Checker = GenericValueTypeChecker<u64>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for Box<str>
impl<'a> FromValue<'a> for Box<str>
type Checker = GenericValueTypeOrNoneChecker<Box<str>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for String
impl<'a> FromValue<'a> for String
type Checker = GenericValueTypeOrNoneChecker<String>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for Vec<GString>
impl<'a> FromValue<'a> for Vec<GString>
type Checker = GenericValueTypeChecker<Vec<GString>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for Vec<String>
impl<'a> FromValue<'a> for Vec<String>
type Checker = GenericValueTypeChecker<Vec<String>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for NonNull<Pointee>
impl<'a> FromValue<'a> for NonNull<Pointee>
type Checker = GenericValueTypeOrNoneChecker<NonNull<c_void>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for PathBuf
impl<'a> FromValue<'a> for PathBuf
type Checker = GenericValueTypeOrNoneChecker<PathBuf>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for NonZeroI8
impl<'a> FromValue<'a> for NonZeroI8
type Checker = GenericValueTypeOrNoneChecker<NonZero<i8>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for NonZeroI32
impl<'a> FromValue<'a> for NonZeroI32
type Checker = GenericValueTypeOrNoneChecker<NonZero<i32>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for NonZeroI64
impl<'a> FromValue<'a> for NonZeroI64
type Checker = GenericValueTypeOrNoneChecker<NonZero<i64>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for NonZeroU8
impl<'a> FromValue<'a> for NonZeroU8
type Checker = GenericValueTypeOrNoneChecker<NonZero<u8>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for NonZeroU32
impl<'a> FromValue<'a> for NonZeroU32
type Checker = GenericValueTypeOrNoneChecker<NonZero<u32>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a> FromValue<'a> for NonZeroU64
impl<'a> FromValue<'a> for NonZeroU64
type Checker = GenericValueTypeOrNoneChecker<NonZero<u64>>
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a, 'b> FromValue<'a> for Vec<&'b FlagsValue>
impl<'a, 'b> FromValue<'a> for Vec<&'b FlagsValue>
type Checker = FlagsTypeChecker
unsafe fn from_value(value: &'a Value) -> Self
Source§impl<'a, T, C, E> FromValue<'a> for Option<T>where
T: FromValue<'a, Checker = C> + StaticType,
C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>,
E: Error + Send + Sized + 'static,
impl<'a, T, C, E> FromValue<'a> for Option<T>where
T: FromValue<'a, Checker = C> + StaticType,
C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>,
E: Error + Send + Sized + 'static,
Blanket implementation for all optional types.