pub struct Tip {
pub id: String,
pub title: String,
pub text: String,
pub contextual: bool,
pub surface: String,
pub command: Option<CommandId>,
pub target: Option<String>,
pub origin: String,
}Expand description
A tip: a title and a text, in English (translated by its id’s keys).
Fields§
§id: String§title: String§text: StringThe text: paragraphs on lines of their own, **bold**,
`code`, {key} and {key:<command>}.
contextual: boolShown only where hint is called, never as the tip of the day.
surface: StringWhere the tip makes sense, a when clause (empty: anywhere).
command: Option<CommandId>The command it teaches: {key} shows its binding.
target: Option<String>The name of what it is about, as drawn (target).
origin: StringWho declared it, for grouping (empty: the id’s first segment).
Implementations§
Source§impl Tip
impl Tip
pub fn new(id: &str, title: &str, text: &str) -> Self
Sourcepub fn contextual(self) -> Self
pub fn contextual(self) -> Self
Kept for hint: not in the tip of the day’s turn.
Sourcepub fn origin_name(&self) -> &str
pub fn origin_name(&self) -> &str
Who declared it: the origin given, else the id’s first segment.
Sourcepub fn parse(file: &str, source: &str) -> Result<Tip, TipError>
pub fn parse(file: &str, source: &str) -> Result<Tip, TipError>
Reads a tip from a file’s text (file).
Sourcepub fn text_in(&self, ctx: &Context) -> String
pub fn text_in(&self, ctx: &Context) -> String
The text in the interface’s language, placeholders left.
Sourcepub fn text_shown(&self, ctx: &Context, app: &AppHandle) -> String
pub fn text_shown(&self, ctx: &Context, app: &AppHandle) -> String
The text as shown: in the interface’s language, {key} and
{key:<command>} replaced by the bindings in force (as
`Ctrl+K`), a command without one by its title in bold. A
translation writes them { $key } and { $key-<command> } (the
command’s dots as dashes), Fluent’s own placeholders.
Trait Implementations§
impl StructuralPartialEq for Tip
Auto Trait Implementations§
impl Freeze for Tip
impl RefUnwindSafe for Tip
impl Send for Tip
impl Sync for Tip
impl Unpin for Tip
impl UnsafeUnpin for Tip
impl UnwindSafe for Tip
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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