pub trait InCopy: Send + Sync {
// Required method
fn in_copy(
&self,
node: &NodeRef<'_, Flm>,
purpose: ValueContent,
) -> CopiedAs;
}Expand description
The aspect that says what replaces an occurrence in a copy of content
shown a second time (CopiedAs): the node as written, nothing, or a new
node of the element’s own.
Content of the document is copied into a synthesized value
(crate::lang::copy) to be shown a second time, away from where it is
written: a heading’s title that a reference prints, the caption of an
unnumbered float, a defined term, the tag of a list item. Most content is
shown again as it was written, and an element that does not declare this
aspect is copied as written. An element that must not be repeated returns
something else. For example, an xnote shown again would be a second note
with the same number and the same labels, so the xnotes feature returns a
new node of its own in the xnote’s place, which its lowering rules write as
the xnote’s mark.
The copy operation reads the aspect when the copy is made, once per node
and per copy, for every node it copies at every depth: the children of a
node that gives CopiedAs::Verbatim are read in turn, and the copy does
not descend into a node that gives anything else. Like every aspect, it is
evaluated per occurrence, from the element’s data and the node.
Only a copy shown again (ValueContent::Shown) reads the aspect. A copy
that the synthesized value holds as its own content (ValueContent::Own)
is copied as written regardless of the aspect: a use site of a user
definition copied to be expanded is the document’s content at that
place, and content copied to be read must be what was written.
The library has no built-in stand-in element: the element, its payload and
its lowering rules belong to the feature that returns the stand-in. Read the
result with copied_as, which gives CopiedAs::Verbatim for an
element that does not declare the aspect and for every copy of
ValueContent::Own content.
Required Methods§
Sourcefn in_copy(&self, node: &NodeRef<'_, Flm>, purpose: ValueContent) -> CopiedAs
fn in_copy(&self, node: &NodeRef<'_, Flm>, purpose: ValueContent) -> CopiedAs
What replaces this occurrence in a copy made for purpose.
Only a copy shown again reads the aspect, so purpose is currently
always ValueContent::Shown; it is passed so that an element can
distinguish a purpose added later.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl InCopy for XnoteElement
In content copied to be shown again, an xnote becomes one node of the
element MARK_OF that identifies it (MarkOf), written as its mark;
in a copy of content that a synthesized value holds as its own
(ValueContent::Own), it is copied as written (copied_as).