pub struct UserdefsData {
pub macros: Vec<NamedDefinition>,
pub environments: Vec<NamedDefinition>,
pub specials: Vec<NamedDefinition>,
pub recursion_limit: usize,
}Expand description
The settings of the userdefs feature as data gives them: the user
definitions in one map per kind, and the expansion depth limit.
The library reads the settings into this type and converts it to a
UserdefsConfig with From: the macros in the order written, then the
environments, then the special character sequences, each entry giving the
definitions that DefinitionData::definitions returns for it (one, or one
per parsing mode). The field documentation below is the description of each
settings key in the settings’ JSON Schema.
§Examples
use flm_core::stdlib::features::userdefs::{Definition, UserdefsConfig, UserdefsData};
let data = serde_json::json!({
"macros": { "hi": { "content": "Hello" } },
"environments": { "hi": { "content": "#{body}" } },
});
let config = UserdefsConfig::from(serde_json::from_value::<UserdefsData>(data)?);
assert_eq!(config.definitions.len(), 2);
assert_eq!(config.definitions[1].display_name(), "\\begin{hi}");Fields§
§macros: Vec<NamedDefinition>The macros: a map from a macro’s name, without the backslash, to its definition. The order written is kept.
environments: Vec<NamedDefinition>The environments: a map from an environment’s name to its definition. The order written is kept.
specials: Vec<NamedDefinition>The special character sequences: a map from the characters of a sequence to its definition. The order written is kept.
recursion_limit: usizeThe expansion depth limit: how many expansions one chain of use sites
may nest before a use site is reported with
flm.userdefs.recursion-limit. The default is 32
(UserdefsConfig::recursion_limit).
Trait Implementations§
Source§impl Clone for UserdefsData
impl Clone for UserdefsData
Source§impl Debug for UserdefsData
impl Debug for UserdefsData
Source§impl Default for UserdefsData
impl Default for UserdefsData
Source§fn default() -> UserdefsData
fn default() -> UserdefsData
Source§impl<'de> Deserialize<'de> for UserdefsDatawhere
UserdefsData: Default,
impl<'de> Deserialize<'de> for UserdefsDatawhere
UserdefsData: 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 From<UserdefsData> for UserdefsConfig
impl From<UserdefsData> for UserdefsConfig
Source§fn from(data: UserdefsData) -> UserdefsConfig
fn from(data: UserdefsData) -> UserdefsConfig
Source§impl JsonSchema for UserdefsData
impl JsonSchema for UserdefsData
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 UserdefsData
impl !UnwindSafe for UserdefsData
impl Forget for UserdefsData
impl Freeze for UserdefsData
impl Move for UserdefsData
impl Send for UserdefsData
impl Sync for UserdefsData
impl Unpin for UserdefsData
impl UnsafeUnpin for UserdefsData
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