pub struct CommandPiece<'n, 't> {
pub span: FlmSpan,
pub state: Arc<ParsingState<Flm>>,
pub arguments: Vec<Option<Vec<ValuePiece<'n, 't>>>>,
/* private fields */
}Expand description
A new node that copy_pieces_into_value creates for a command of the
language (\emph{…}, \href{…}{…}) whose arguments hold value pieces
(ValuePiece): the node a parse of the command written with those
arguments would produce, carrying the command’s element, so that it is read,
rewritten and lowered like the written command.
Build one with CommandPiece::new, which looks the command up in the
language as a parsing state defines it, then fill
arguments. The node is recorded as written with
a backslash and nothing after the name. Each provided argument’s content is
the copies of its pieces, as direct children of the node; a text piece gets
an empty span at the start of the node’s span.
Fields§
§span: FlmSpanThe node’s span: where a diagnostic about the node points.
state: Arc<ParsingState<Flm>>The parsing state the node is added under, and in which the command was looked up.
arguments: Vec<Option<Vec<ValuePiece<'n, 't>>>>The pieces of each argument, in the order in which the command declares
its arguments; None, or no entry past the end of the list, for an
argument not provided. More entries than the command has arguments make
the copy fail (CopyError::Failed).
Implementations§
Source§impl<'n, 't> CommandPiece<'n, 't>
impl<'n, 't> CommandPiece<'n, 't>
Sourcepub fn new(
name: &str,
span: FlmSpan,
state: Arc<ParsingState<Flm>>,
) -> Result<Option<CommandPiece<'n, 't>>, CopyError>
pub fn new( name: &str, span: FlmSpan, state: Arc<ParsingState<Flm>>, ) -> Result<Option<CommandPiece<'n, 't>>, CopyError>
Returns the command \name as the language defines it under state,
at span, with no argument provided yet: Ok(Some(_)) for a command
the language defines there; Ok(None) where it defines no such command
(the feature that defines it is not in the registry, and a parse would
treat the command as unknown, UNKNOWN_MACRO).
§Errors
CopyError::Failed when looking the command up fails: a provider of
command definitions on the state’s scope stack returned an error.
Trait Implementations§
Source§impl<'n, 't> Clone for CommandPiece<'n, 't>
impl<'n, 't> Clone for CommandPiece<'n, 't>
Auto Trait Implementations§
impl<'n, 't> !RefUnwindSafe for CommandPiece<'n, 't>
impl<'n, 't> !UnwindSafe for CommandPiece<'n, 't>
impl<'n, 't> Forget for CommandPiece<'n, 't>
impl<'n, 't> Freeze for CommandPiece<'n, 't>where
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<dyn CallableSpec<Flm>> is !null: Freeze,
PhantomData<ArcInner<dyn CallableSpec<Flm>>>: Freeze,
*const ArcInner<Source<FlmOrigin>> is !null: Freeze,
PhantomData<ArcInner<Source<FlmOrigin>>>: Freeze,
*const ArcInner<ParsingState<Flm>> is !null: Freeze,
PhantomData<ArcInner<ParsingState<Flm>>>: Freeze,
PhantomData<Option<Vec<ValuePiece<'n, 't>>>>: Freeze,
impl<'n, 't> Move for CommandPiece<'n, 't>
impl<'n, 't> Send for CommandPiece<'n, 't>
impl<'n, 't> Sync for CommandPiece<'n, 't>
impl<'n, 't> Unpin for CommandPiece<'n, 't>
impl<'n, 't> UnsafeUnpin for CommandPiece<'n, 't>where
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<dyn CallableSpec<Flm>> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn CallableSpec<Flm>>>: UnsafeUnpin,
*const ArcInner<Source<FlmOrigin>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Source<FlmOrigin>>>: UnsafeUnpin,
*const ArcInner<ParsingState<Flm>> is !null: UnsafeUnpin,
PhantomData<ArcInner<ParsingState<Flm>>>: UnsafeUnpin,
PhantomData<Option<Vec<ValuePiece<'n, 't>>>>: 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