logos.lang.convert

Module lang · package logos-lang

Traits

traitBorrow

trait Borrow

Borrows self as a &Borrowed view.

Contract (as in Rust): Eq/Ord/Hash of the borrowed view must agree with the owned value — keyed collection lookups (HashMap::get) rely on it.

Implemented by: i8 i16 i32 i64 u8 u16 u32 u64 bool

traitBorrowMut

trait BorrowMut

Borrows self as a &mut Borrowed view; mutable counterpart of Borrow.

Implemented by: i8 i16 i32 i64 u8 u16 u32 u64 bool

traitFrom

trait From

Converts a value of type T into Self; infallible and value-consuming.

Implementing From<T> for U also enables t.into() via the blanket Into impl, so implement From rather than Into.

Implemented by: i16 i32 i64 i32 i64 i64 u16 u32 u64 u32 u64 u64 i16 i32 i64 i32 i64 i64 u32 i32 i64 u32 u64 u8

traitInto

trait Into

Converts self into a value of type T; infallible and value-consuming.

Do not implement directly: blanket-derived from every From<S> for T impl.

Implemented by: S

traitTryFrom

trait TryFrom

Converts a value of type T into Self, failing with ConvertError when out of range.

Implemented by: i8 i16 u8 u16 u32 i32 u64 i32 u16 u8 u32 i64 char

traitTryInto

trait TryInto

Converts self into a value of type T, failing with ConvertError when out of range.

Do not implement directly: blanket-derived from every TryFrom<S> for T impl.

Implemented by: S

Types

structConvertError

struct ConvertError

Reports a failed TryFrom/TryInto conversion.

Empty marker payload: these conversions only fail in one way (out-of-range), so the error value is information-free.