Skip to main content

TryToValue

Trait TryToValue 

Source
pub trait TryToValue<S: ValueSchema> {
    type Error;

    // Required method
    fn try_to_value(self) -> Result<Value<S>, Self::Error>;
}
Expand description

A trait for converting a Rust type to a Value with a specific schema type. This trait is implemented on the concrete Rust type.

This might return an error if the conversion is not possible, see ToValue for cases where the conversion is guaranteed to succeed (or panic).

This is the counterpart to the TryFromValue trait.

Required Associated Types§

Source

type Error

The error type returned when the conversion fails.

Required Methods§

Source

fn try_to_value(self) -> Result<Value<S>, Self::Error>

Convert the Rust type to a Value with a specific schema type. This might return an error if the conversion is not possible.

See the ToValue trait for a conversion that always succeeds (or panics).

Implementations on Foreign Types§

Source§

impl TryToValue<Boolean> for &bool

Source§

impl TryToValue<Boolean> for bool

Source§

impl TryToValue<F64> for &Number

Source§

impl TryToValue<F64> for Number

Source§

impl TryToValue<F256LE> for &Number

Source§

impl TryToValue<F256LE> for Number

Source§

impl TryToValue<GenId> for &str

Source§

impl TryToValue<GenId> for &Uuid

Source§

impl TryToValue<GenId> for Uuid

Source§

impl TryToValue<RangeInclusiveU128> for RangeInclusive<u128>

Source§

impl TryToValue<RangeU128> for Range<u128>

Source§

impl TryToValue<ShortString> for &str

Source§

impl TryToValue<ShortString> for String

Source§

impl TryToValue<NsTAIInterval> for (Epoch, Epoch)

Source§

impl<H> TryToValue<Hash<H>> for &str
where H: HashProtocol,

Source§

impl<H> TryToValue<Hash<H>> for String
where H: HashProtocol,

Implementors§