pub struct PayloadReaders { /* private fields */ }Expand description
The payload readers of a reading session, one per element, keyed by the element’s stable name.
A backend registers one reader for each of its presentation elements whose
nodes carry a payload, and a feature registers one for an element whose
rebuilt nodes carry a payload (see PresPayload). Reading a payload of an
element with no reader registered fails with an error that identifies the
element.
Its public path is crate::dump::session::PayloadReaders.
Implementations§
Source§impl PayloadReaders
impl PayloadReaders
Sourcepub fn new() -> PayloadReaders
pub fn new() -> PayloadReaders
Returns a set with no reader in it.
Sourcepub fn register<F>(
&mut self,
element: impl Into<ElementName>,
reader: F,
) -> Option<PayloadReader>where
F: Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync + 'static,
pub fn register<F>(
&mut self,
element: impl Into<ElementName>,
reader: F,
) -> Option<PayloadReader>where
F: Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync + 'static,
Registers reader for the payloads of the element named element, and
returns the reader it replaced, if there was one.
Sourcepub fn get(&self, element: &str) -> Option<&PayloadReader>
pub fn get(&self, element: &str) -> Option<&PayloadReader>
Returns the reader registered for the element named element, if there
is one.
Sourcepub fn elements(&self) -> impl Iterator<Item = &ElementName> + '_
pub fn elements(&self) -> impl Iterator<Item = &ElementName> + '_
Returns the names of the elements that have a reader, in name order.
Trait Implementations§
Source§impl Clone for PayloadReaders
impl Clone for PayloadReaders
Source§impl Debug for PayloadReaders
impl Debug for PayloadReaders
Auto Trait Implementations§
impl !RefUnwindSafe for PayloadReaders
impl !UnwindSafe for PayloadReaders
impl Forget for PayloadReaders
impl Freeze for PayloadReaderswhere
*const LeafNode<ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>)>>: Freeze,
impl Move for PayloadReaders
impl Send for PayloadReaderswhere
NodeRef<Owned, ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>, LeafOrInternal>: Send,
BoxRaw<(ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>)>: Send,
impl Sync for PayloadReaderswhere
NodeRef<Owned, ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>, LeafOrInternal>: Sync,
BoxRaw<(ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>)>: Sync,
impl Unpin for PayloadReaderswhere
*const LeafNode<ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>> is !null: Unpin,
Box<(ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>)>: Unpin,
impl UnsafeUnpin for PayloadReaderswhere
*const LeafNode<ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(ElementName, Arc<dyn Fn(&SerialValue, &mut DeserializeContext<'_, Flm>) -> Result<Arc<dyn PresPayload>, DeserializeError> + Send + Sync>)>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Casts the value.
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.