pub struct RefsConfig {
pub join: JoinDecl,
}Expand description
The configuration of the refs feature: the texts that join the
items of a reference to several targets.
A \ref with several targets is written as one list. Its first items are
the numbers of the targets the document numbered, one item per counter
style, each written by that style, the styles in the order the reference
first reaches them; then comes each target without a number, in the order
the reference wrote them. join joins the items. It is
a JoinDecl, the type a counter style declares its own joining texts
with, with the same keys, the same variables ${and} and ${sep} and the
same defaults, so that a caller changes the word “and” the same way in both
places. By default, two items read Eq. (1) and Thm. 1.1, and three read
Eq. (1), Thm. 1.1, and A note.
One item is written one_pre, the item, one_post. Two items are written
pair_pre, the first, pair_mid, the second, pair_post. Three or more
are written list_pre, the items with list_mid between them and
list_midlast before the last, then list_post. The range texts
(range_pre, range_mid, range_pairmid, range_post) and the empty
text never apply to a reference list, whose items are never ranges of
several items; they are still accepted, so that one JoinDecl can serve
a counter style and this list.
A feature’s configuration is the plain Rust value the feature is
constructed from; it is fixed when the registry is built (settings,
options and
configuration).
Every text is parsed as FLM once, when the registry is built: a text that
does not parse, or that refers to a variable nothing defines, fails the
registry build, as a counter style’s text does. Because the configuration
changes what the registry produces, the feature adds
digest_bytes to the registry digest.
§Examples
use flm_core::stdlib::features::numbering::JoinDecl;
use flm_core::stdlib::features::refs::RefsConfig;
let mut german = JoinDecl::default();
german.and = Some("und".to_string());
let config = RefsConfig::new().join(german);
assert_eq!(config.join.and.as_deref(), Some("und"));Fields§
§join: JoinDeclThe texts that join the items of a reference to several targets.
Default: the defaults of JoinDecl.
Implementations§
Source§impl RefsConfig
impl RefsConfig
Sourcepub fn new() -> RefsConfig
pub fn new() -> RefsConfig
The default configuration: the default joining texts.
Sourcepub fn join(self, join: JoinDecl) -> RefsConfig
pub fn join(self, join: JoinDecl) -> RefsConfig
Builder: sets the texts that join the items of a reference to several targets.
Sourcepub fn digest_bytes(&self) -> Vec<u8> ⓘ
pub fn digest_bytes(&self) -> Vec<u8> ⓘ
The bytes this configuration adds to the registry digest: every joining text, each preceded by whether it is set and by its length, so that two different configurations never produce the same bytes.
Trait Implementations§
Source§impl Clone for RefsConfig
impl Clone for RefsConfig
Source§impl Debug for RefsConfig
impl Debug for RefsConfig
Source§impl Default for RefsConfig
impl Default for RefsConfig
Source§impl<'de> Deserialize<'de> for RefsConfigwhere
RefsConfig: Default,
impl<'de> Deserialize<'de> for RefsConfigwhere
RefsConfig: 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>,
impl Eq for RefsConfig
Source§impl Hash for RefsConfig
impl Hash for RefsConfig
Source§impl JsonSchema for RefsConfig
impl JsonSchema for RefsConfig
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 moreSource§impl PartialEq for RefsConfig
impl PartialEq for RefsConfig
impl StructuralPartialEq for RefsConfig
Auto Trait Implementations§
impl Forget for RefsConfig
impl Freeze for RefsConfig
impl Move for RefsConfig
impl RefUnwindSafe for RefsConfig
impl Send for RefsConfig
impl Sync for RefsConfig
impl Unpin for RefsConfig
impl UnsafeUnpin for RefsConfig
impl UnwindSafe for RefsConfig
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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