pub struct ReadEnvironment { /* private fields */ }Expand description
The read environment: FLM’s part of what a reading session needs. The other
part is techy’s KnownProviders, the reading language’s packages.
It holds three things: the reading language’s structural elements, which
every state extension read in the session shares; the ElementResolver
for every other element name in the serialized data; and the
PayloadReaders.
It must be set as the session’s user data;
crate::dump::session::reader does that, along with everything else a
reading session needs. Its public path is
crate::dump::session::ReadEnvironment.
Implementations§
Source§impl ReadEnvironment
impl ReadEnvironment
Sourcepub fn new(
structural: Arc<StructuralElements>,
elements: Arc<dyn ElementResolver>,
) -> ReadEnvironment
pub fn new( structural: Arc<StructuralElements>, elements: Arc<dyn ElementResolver>, ) -> ReadEnvironment
Returns an environment with the given structural elements and element
resolver, and no payload reader. Add readers with
ReadEnvironment::with_payload_readers.
Sourcepub fn with_payload_readers(self, readers: PayloadReaders) -> ReadEnvironment
pub fn with_payload_readers(self, readers: PayloadReaders) -> ReadEnvironment
Builder: sets the payload readers, replacing any already set.
Sourcepub fn structural(&self) -> &Arc<StructuralElements> ⓘ
pub fn structural(&self) -> &Arc<StructuralElements> ⓘ
Returns the structural elements that every state extension read in this session shares.
Sourcepub fn resolve_element(
&self,
name: &str,
) -> Result<Option<Arc<ElementSpec>>, AmbiguousElement>
pub fn resolve_element( &self, name: &str, ) -> Result<Option<Arc<ElementSpec>>, AmbiguousElement>
Returns the element named name: a structural element of this
environment’s set when the name is one, and otherwise what the element
resolver returns.
§Errors
AmbiguousElement when several element values share the name.
Sourcepub fn payload_reader(&self, element: &str) -> Option<&PayloadReader>
pub fn payload_reader(&self, element: &str) -> Option<&PayloadReader>
Returns the payload reader of the element named element, if one is
registered.
Trait Implementations§
Source§impl Clone for ReadEnvironment
impl Clone for ReadEnvironment
Auto Trait Implementations§
impl !RefUnwindSafe for ReadEnvironment
impl !UnwindSafe for ReadEnvironment
impl Forget for ReadEnvironment
impl Freeze for ReadEnvironment
impl Move for ReadEnvironment
impl Send for ReadEnvironment
impl Sync for ReadEnvironment
impl Unpin for ReadEnvironment
impl UnsafeUnpin for ReadEnvironment
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
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>,
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>
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> ⓘ
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> ⓘ
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 more