pub struct Annotator {
pub command: String,
pub initials: Option<String>,
}Expand description
One annotator: a reviewer who highlights passages and writes remarks in a document, with the command they write and the initials shown at the start of each of their annotations.
command— the name of the annotator’s command, without the backslash:phfmakes\phf{…}(a highlight),\phf[…](a comment) and\phf … \endphf(a highlight). It must be made of ASCII letters only, like every command name of the language written with letters, and must be neitherbeginnorend, which open and close environments (Annotator::validate).initials— the short text shown where each of the annotator’s highlights and comments starts (in the margin, on an output that has one), such asPhF;Nonefor an annotator whose annotations show no initials. The text is shown as written, never read as markup.
An annotator’s number is its position in
AnnotationsConfig::annotators, counting from zero. The configuration
specifies no color: an output that shows colors chooses one per number
(the HTML stylesheet flm.annotations.style and the phfcc LaTeX package
give the first eight numbers their own colors).
§Examples
use flm_core::stdlib::features::annotations::Annotator;
let reviewer = Annotator::new("phf").initials("PhF");
assert_eq!(reviewer.command, "phf");
assert_eq!(reviewer.initials.as_deref(), Some("PhF"));
assert_eq!(Annotator::new("abc").initials, None);Fields§
§command: StringThe command’s name, without the backslash: phf. In settings, it is
written as the key of the annotator’s entry, not as a field.
initials: Option<String>The initials shown at the start of the annotator’s annotations, such as
PhF; None for none.
Implementations§
Source§impl Annotator
impl Annotator
Sourcepub fn new(command: impl Into<String>) -> Annotator
pub fn new(command: impl Into<String>) -> Annotator
Returns an annotator whose command is command (without the
backslash), with no initials.
Sourcepub fn initials(self, initials: impl Into<String>) -> Annotator
pub fn initials(self, initials: impl Into<String>) -> Annotator
Builder: sets the initials shown at the start of the annotator’s annotations, and returns the annotator.
Sourcepub fn end_command(&self) -> String
pub fn end_command(&self) -> String
Returns the name of the command that closes a passage the annotator
highlights in the third form, \phf … \endphf: end followed by the
command’s name, endphf.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Checks the annotator on its own.
§Errors
Returns a sentence that identifies the annotator and states the
problem: a command that is empty, holds a character other than an
ASCII letter, or is begin or end (none of which the language could
read as the annotator’s command); or initials that are empty or made
only of whitespace (an annotator whose annotations show no initials has
None).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Annotator
impl<'de> Deserialize<'de> for Annotator
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 Annotator
Source§impl JsonSchema for Annotator
impl JsonSchema for Annotator
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 NamedEntry for Annotator
In settings, an annotator is written under its command’s name, as one
entry of the map AnnotationsConfig::annotators.
impl NamedEntry for Annotator
In settings, an annotator is written under its command’s name, as one
entry of the map AnnotationsConfig::annotators.
impl StructuralPartialEq for Annotator
Auto Trait Implementations§
impl Forget for Annotator
impl Freeze for Annotator
impl Move for Annotator
impl RefUnwindSafe for Annotator
impl Send for Annotatorwhere
RawVecInner: Send,
impl Sync for Annotatorwhere
RawVecInner: Sync,
impl Unpin for Annotator
impl UnsafeUnpin for Annotator
impl UnwindSafe for Annotatorwhere
RawVecInner: UnwindSafe,
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