pub struct FlmNodeExt {
pub element: Arc<ElementSpec>,
pub source_map: Option<Arc<TextSourceMap>>,
pub payload: Option<Arc<dyn PresPayload>>,
}Expand description
The data FLM attaches to every node: its element, and two optional fields.
Flm::make_node_ext builds it
once, when techy adds the node to a tree. Every node has an
element. A text node whose characters were rewritten also
has a source map. A presentation node, and a synthesized
or rebuilt node that carries data of its own, also has a
payload. A node copied into another tree keeps its
extension unchanged; a node the library creates gets a new extension when it
is created.
Fields§
§element: Arc<ElementSpec>The node’s element: what the node means.
source_map: Option<Arc<TextSourceMap>>Where each byte of a text node’s text comes from; None means the text
is a byte-for-byte copy of the node’s span.
payload: Option<Arc<dyn PresPayload>>The typed payload (PresPayload) of a presentation node, of a
synthesized node that carries data of its own, or of a node a rewrite
pass rebuilt with data of its own (a part of a cut block-transparent
element,
carrying its cut
record); None on every other node.
Implementations§
Source§impl FlmNodeExt
impl FlmNodeExt
Sourcepub fn new(element: Arc<ElementSpec>) -> FlmNodeExt
pub fn new(element: Arc<ElementSpec>) -> FlmNodeExt
Returns the extension of a node carrying element, with no source map
and no payload. A parse builds this for every node.
Sourcepub fn with_source_map(self, map: Arc<TextSourceMap>) -> FlmNodeExt
pub fn with_source_map(self, map: Arc<TextSourceMap>) -> FlmNodeExt
Builder: sets map as the node’s source map
(source_map).
Sourcepub fn with_payload(self, payload: Arc<dyn PresPayload>) -> FlmNodeExt
pub fn with_payload(self, payload: Arc<dyn PresPayload>) -> FlmNodeExt
Builder: sets payload as the node’s payload
(payload).
Trait Implementations§
Source§impl Clone for FlmNodeExt
impl Clone for FlmNodeExt
Source§impl Debug for FlmNodeExt
impl Debug for FlmNodeExt
Source§impl DeserializableValue<Flm> for FlmNodeExt
When a reference to a specification is written, the element is the one that
specification carries, by identity, and its name must agree with the written
name. Otherwise it is the read environment’s element of that name. A payload
is rebuilt by the reader registered for the element (PayloadReaders).
impl DeserializableValue<Flm> for FlmNodeExt
When a reference to a specification is written, the element is the one that
specification carries, by identity, and its name must agree with the written
name. Otherwise it is the read environment’s element of that name. A payload
is rebuilt by the reader registered for the element (PayloadReaders).
Source§fn deserialize_value(
value: &SerialValue,
cx: &mut DeserializeContext<'_, Flm>,
) -> Result<Self, DeserializeError>
fn deserialize_value( value: &SerialValue, cx: &mut DeserializeContext<'_, Flm>, ) -> Result<Self, DeserializeError>
cx gives the call access to the
state of the deserialization in progress. Read moreSource§fn deserialize_field(
name: &'static str,
value: Option<&SerialValue>,
cx: &mut DeserializeContext<'_, L>,
) -> Result<Self, DeserializeError>where
L: SerializableLang,
fn deserialize_field(
name: &'static str,
value: Option<&SerialValue>,
cx: &mut DeserializeContext<'_, L>,
) -> Result<Self, DeserializeError>where
L: SerializableLang,
name of a structure whose fields are read by
name (a type with #[derive(DeserializableValue)]): value is the field’s
value, or None when the key is missing from the map. The default requires
the key and reads its value with deserialize_value;
Option<T> reads a missing key as None. The counterpart of
SerializableValue::is_absent_field: a type overriding one overrides both. Read moreSource§impl SerializableValue<Flm> for FlmNodeExt
A node extension is written as {element, spec?, source_map?, payload?}:
the element’s stable name; a reference to the specification carrying that
exact element value, when the WriteEnvironment records one; the source
map, when the node has one; and the payload’s projection
(PresPayload::project), when the node has a payload.
impl SerializableValue<Flm> for FlmNodeExt
A node extension is written as {element, spec?, source_map?, payload?}:
the element’s stable name; a reference to the specification carrying that
exact element value, when the WriteEnvironment records one; the source
map, when the node has one; and the payload’s projection
(PresPayload::project), when the node has a payload.
Source§fn serialize_value(
&self,
cx: &mut SerializeContext<'_, Flm>,
) -> Result<SerialValue, SerializeError>
fn serialize_value( &self, cx: &mut SerializeContext<'_, Flm>, ) -> Result<SerialValue, SerializeError>
cx gives the call access to the state
of the serialization in progress — a value that refers to a table object
(a span’s source, say) interns it through cx and embeds the position. Read moreSource§fn is_absent_field(&self) -> boolwhere
L: SerializableLang,
fn is_absent_field(&self) -> boolwhere
L: SerializableLang,
#[derive(SerializableValue)]), is left out of the structure’s map
entirely — no key at all, rather than a key with a null value. The default is
false; Option<T> is absent when it is None. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for FlmNodeExt
impl !UnwindSafe for FlmNodeExt
impl Forget for FlmNodeExt
impl Freeze for FlmNodeExtwhere
*const ArcInner<ElementSpec> is !null: Freeze,
PhantomData<ArcInner<ElementSpec>>: Freeze,
*const ArcInner<TextSourceMap> is !null: Freeze,
PhantomData<ArcInner<TextSourceMap>>: Freeze,
*const ArcInner<dyn PresPayload> is !null: Freeze,
PhantomData<ArcInner<dyn PresPayload>>: Freeze,
impl Move for FlmNodeExt
impl Send for FlmNodeExt
impl Sync for FlmNodeExt
impl Unpin for FlmNodeExt
impl UnsafeUnpin for FlmNodeExtwhere
*const ArcInner<ElementSpec> is !null: UnsafeUnpin,
PhantomData<ArcInner<ElementSpec>>: UnsafeUnpin,
*const ArcInner<TextSourceMap> is !null: UnsafeUnpin,
PhantomData<ArcInner<TextSourceMap>>: UnsafeUnpin,
*const ArcInner<dyn PresPayload> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn PresPayload>>: 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
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