pub enum Reader<'a> {
}
Expand description
A dynamically-typed read-only value.
Variants§
Void
Bool(bool)
Int8(i8)
Int16(i16)
Int32(i32)
Int64(i64)
UInt8(u8)
UInt16(u16)
UInt32(u32)
UInt64(u64)
Float32(f32)
Float64(f64)
Enum(Enum)
Text(Reader<'a>)
Data(Reader<'a>)
Struct(Reader<'a>)
List(Reader<'a>)
AnyPointer(Reader<'a>)
Capability(Capability)
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
pub fn new(value: Reader<'a>, ty: Type) -> Result<Self>
Sourcepub fn downcast<T: DowncastReader<'a>>(self) -> T
pub fn downcast<T: DowncastReader<'a>>(self) -> T
Downcasts the Reader
into a more specific type. Panics if the
expected type does not match the value.
Sourcepub fn downcast_struct<T: OwnedStruct>(self) -> T::Reader<'a>
pub fn downcast_struct<T: OwnedStruct>(self) -> T::Reader<'a>
Downcasts the Reader
into a specific struct type. Panics if the
expected type does not match the value.
Design note: instead of this method, it would be better to add a blanket impl
of the DowncastBuilder
trait that covered every struct type. Unfortunately,
the current way the Introspect
and OwnedStruct
traits are set up does not
seem to allow this.
Trait Implementations§
Source§impl<'a> From<Capability> for Reader<'a>
impl<'a> From<Capability> for Reader<'a>
Source§fn from(c: Capability) -> Reader<'a>
fn from(c: Capability) -> Reader<'a>
Converts to this type from the input type.
Source§impl From<ElementSize> for Reader<'_>
impl From<ElementSize> for Reader<'_>
Source§fn from(e: ElementSize) -> Self
fn from(e: ElementSize) -> Self
Converts to this type from the input type.
Source§impl<'a, T: TryFrom<u16, Error = NotInSchema> + Introspect> From<Reader<'a, T>> for Reader<'a>
impl<'a, T: TryFrom<u16, Error = NotInSchema> + Introspect> From<Reader<'a, T>> for Reader<'a>
Source§impl<'a, T: PrimitiveElement + Introspect> From<Reader<'a, T>> for Reader<'a>
impl<'a, T: PrimitiveElement + Introspect> From<Reader<'a, T>> for Reader<'a>
impl<'a> Copy for Reader<'a>
Auto Trait Implementations§
impl<'a> Freeze for Reader<'a>
impl<'a> !RefUnwindSafe for Reader<'a>
impl<'a> !Send for Reader<'a>
impl<'a> !Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> !UnwindSafe for Reader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more