pub struct DefinitionData {
pub args: Vec<ArgDef>,
pub content: Option<DefinitionContent>,
pub defaults: BTreeMap<String, String>,
pub argument_number_offset: usize,
pub block_role: BlockRole,
pub expand: ExpandPolicy,
pub overrides: bool,
pub docs: String,
}Expand description
A user definition as data gives it, under its name in the map of its kind
(UserdefsData): the fields of a Definition except its name, its
kind and its parsing modes, which the entry’s name, the map and the content
give, and except its extra placeholders
(Definition::extra_placeholder), which only a definition declared in
Rust can have. A field not written keeps the value that
Definition::new gives it.
definitions returns the definitions the
entry declares, given its kind and its name. The field documentation below
is the description of each settings key in the settings’ JSON Schema.
Fields§
§args: Vec<ArgDef>The arguments, in the order they are written at a use site. Each
argument gives its syntax as a structured syntax: a map whose key
syntax holds the name of a standard kind of argument and whose other
keys hold the kind’s parameters, beside the argument’s own keys
(name, mode, layout, opaque_wrapper, scoped, events, docs,
role),
as in {syntax: delimited-group, delimiters: ["(", ")"], name: size}
for a group in parentheses named size. An argument code is a
shorthand for a structured syntax: in a map, the key code holds it in
place of syntax, so {code: "r()", name: size} declares the same
argument; a code alone ("{") declares an argument with no other key.
The list is written in one of three shapes: one text in which each
character is one code ("[{"); a list of codes (["[", "r()"]); or a
list whose entries are each a code or a map. The kinds and their
parameters are listed in the documentation of the standard
kinds, and the codes
in the table of argument codes.
content: Option<DefinitionContent>The template: FLM text with placeholders, which replaces every use site.
One text is the template in text mode and in mathematics mode, and the
definition applies in each mode where the text parses. A map with the
keys text and math, one or both written, gives one template per
mode, and the definition applies in the modes written.
defaults: BTreeMap<String, String>The default values of the arguments: template text, keyed by the argument’s declared name or by the number a placeholder refers to it by. A default value replaces the placeholders of an argument that a use site leaves out.
argument_number_offset: usizeThe argument number offset: how many of the first declared arguments
the numbered placeholders skip, so that #1 refers to the argument at
this index (counting from zero).
block_role: BlockRoleThe block role of the definition’s element: a block of its own, inline content, a displayed item, or a block decorator.
expand: ExpandPolicyWhen the use sites are expanded: always, in every plan, or per-plan
(the default), as each plan decides.
overrides: boolWhether this definition replaces another feature’s definition of the same command. Without it, two features that define one command make the registry build fail, unless the feature order places the feature registered last explicitly after the other.
docs: StringThe definition’s documentation, shown wherever the registry describes its element.
Implementations§
Source§impl DefinitionData
impl DefinitionData
Sourcepub fn definitions(
self,
kind: DefinitionKind,
name: impl Into<Name>,
) -> Vec<Definition>
pub fn definitions( self, kind: DefinitionKind, name: impl Into<Name>, ) -> Vec<Definition>
Returns the definitions the entry declares as a definition of kind
kind with the name name: one definition that applies in both modes
when the content is one text or is not written; for a content given per
mode, one definition per mode written, the one for text mode first, each
applying in its mode alone (as Definition::text and
Definition::math declare).
Trait Implementations§
Source§impl Clone for DefinitionData
impl Clone for DefinitionData
Source§impl Debug for DefinitionData
impl Debug for DefinitionData
Source§impl Default for DefinitionData
impl Default for DefinitionData
Source§fn default() -> DefinitionData
fn default() -> DefinitionData
Source§impl<'de> Deserialize<'de> for DefinitionDatawhere
DefinitionData: Default,
impl<'de> Deserialize<'de> for DefinitionDatawhere
DefinitionData: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for DefinitionData
impl JsonSchema for DefinitionData
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DefinitionData
impl !UnwindSafe for DefinitionData
impl Forget for DefinitionData
impl Freeze for DefinitionDatawhere
*const u8 is !null: Freeze,
PhantomData<ArgDef>: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, String> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, String)>>: Freeze,
impl Move for DefinitionData
impl Send for DefinitionData
impl Sync for DefinitionData
impl Unpin for DefinitionData
impl UnsafeUnpin for DefinitionDatawhere
*const u8 is !null: UnsafeUnpin,
PhantomData<ArgDef>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: 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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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