pub struct LatexPackageDef {
pub id: Name,
pub package: Cow<'static, str>,
pub options: Vec<Cow<'static, str>>,
pub docs: String,
pub engines: EngineSet,
}Expand description
The definition of one package request: the package to load and its options, under the identifier a package request resolves through.
A feature contributes a definition to the slot SLOT, and a lowering
rule requires it by its id. A definition is not by itself a
line of the style file: every request for one package is merged into the
single PackageRequest the file writes for that package
(merge_requests), whose options are the union of theirs and whose
comment line lists every identifier behind it. A request applies to the
engines of engines: a request written by hand to
every engine, a request derived from a chunk of the Unicode-to-LaTeX table
to the engines of its case. requirepackage_line
writes this one request on its own, for a caller that asks what a single
request says rather than what the style file holds.
The same value is also how a document’s author asks for a package of their
own: the latex-recomposed render option
extra_packages
is a list of these, which join the document’s own requests, after them,
before the merge. Such a request is built directly (in Rust with
new; in settings as a map with the keys id, package,
options and docs, all required) rather than contributed to the slot,
since no rule requires it by identifier.
Fields§
§id: NameThe identifier, flm.latex.pkg.<name>.
package: Cow<'static, str>The package’s name as \usepackage takes it (zref-clever).
options: Vec<Cow<'static, str>>The options, written comma-separated in brackets when not empty.
docs: StringA short text, for a person reading the definition, saying what the package provides and when a document needs it. It is not written into the style file.
engines: EngineSetThe engines the request applies to. A request an author writes, and
every request the family declares by hand, is one case for every
engine (EngineSet::ALL); a request derived from a chunk of the
Unicode-to-LaTeX table applies to the engines of its case
(chunk_packages), and one identifier then resolves to one
definition per set of engines (packages_named). It is not part of
the author-facing form of a request: the settings schema does not
show it, and settings that give it are refused.
Implementations§
Source§impl LatexPackageDef
impl LatexPackageDef
Sourcepub fn new(
package: impl Into<Cow<'static, str>>,
docs: impl Into<String>,
) -> LatexPackageDef
pub fn new( package: impl Into<Cow<'static, str>>, docs: impl Into<String>, ) -> LatexPackageDef
The request of the package package under the identifier
package_id(package), with no options, applying to every engine;
docs says what the package provides and when a document needs it
(docs).
Sourcepub fn id(self, id: impl Into<Name>) -> LatexPackageDef
pub fn id(self, id: impl Into<Name>) -> LatexPackageDef
The same request under another identifier, for a package requested twice with different options, each request under an identifier of its own.
Sourcepub fn options(
self,
options: impl IntoIterator<Item = impl Into<Cow<'static, str>>>,
) -> Self
pub fn options( self, options: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> Self
The same request with the given package options.
Sourcepub fn engines(self, engines: EngineSet) -> Self
pub fn engines(self, engines: EngineSet) -> Self
The same request applying to engines alone
(engines).
Sourcepub fn usepackage_line(&self) -> String
pub fn usepackage_line(&self) -> String
The request as a document writes it: \usepackage[opts]{package},
without a newline. The line says nothing of the engines the request
applies to (engines).
Sourcepub fn requirepackage_line(&self) -> String
pub fn requirepackage_line(&self) -> String
The request as a style file writes it: \RequirePackage[opts]{package},
without a trailing newline. The line says nothing of the engines the
request applies to (engines): where a package’s
requests differ by engine, the style file’s block writes the lines
inside a test of the engine (style_body),
and the style file is the same regardless of the engine that reads it.
Trait Implementations§
Source§impl Clone for LatexPackageDef
impl Clone for LatexPackageDef
Source§impl Debug for LatexPackageDef
impl Debug for LatexPackageDef
Source§impl<'de> Deserialize<'de> for LatexPackageDef
impl<'de> Deserialize<'de> for LatexPackageDef
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 LatexPackageDef
Source§impl Hash for LatexPackageDef
impl Hash for LatexPackageDef
Source§impl JsonSchema for LatexPackageDef
impl JsonSchema for LatexPackageDef
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 LatexPackageDef
impl PartialEq for LatexPackageDef
impl StructuralPartialEq for LatexPackageDef
Auto Trait Implementations§
impl Forget for LatexPackageDef
impl Freeze for LatexPackageDef
impl Move for LatexPackageDef
impl RefUnwindSafe for LatexPackageDef
impl Send for LatexPackageDef
impl Sync for LatexPackageDef
impl Unpin for LatexPackageDef
impl UnsafeUnpin for LatexPackageDefwhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
&'static str: UnsafeUnpin,
String: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Cow<'static, str>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for LatexPackageDef
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