Struct Cursor

pub struct Cursor(/* private fields */);
Expand description

Wraps Token with a SourceOffset, allows it to reason about the character data of the source text.

Implementations§

§

impl Cursor

pub const DUMMY_SITE_NUMBER_ZERO: Cursor

pub const EMPTY: Cursor

pub const fn new(offset: SourceOffset, token: Token) -> Cursor

pub const fn dummy(token: Token) -> Cursor

pub const fn token(&self) -> Token

pub const fn offset(&self) -> SourceOffset

pub fn end_offset(&self) -> SourceOffset

pub const fn is_empty(&self) -> bool

pub const fn len(&self) -> u32

pub fn span(&self) -> Span

pub fn write_str(&self, str: &str, f: &mut impl Write) -> Result<(), Error>

pub fn str_slice<'a>(&self, str: &'a str) -> &'a str

pub fn eq_ignore_ascii_case<'a>(&self, source: &'a str, other: &'a str) -> bool

pub fn parse_str<'a>(&self, source: &'a str, allocator: &'a Bump) -> &'a str

pub fn parse_str_lower<'a>( &self, source: &'a str, allocator: &'a Bump, ) -> &'a str

pub fn with_quotes(&self, quote_style: QuoteStyle) -> Cursor

pub fn with_associated_whitespace( &self, rules: AssociatedWhitespaceRules, ) -> Cursor

Trait Implementations§

§

impl Clone for Cursor

§

fn clone(&self) -> Cursor

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Cursor

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Cursor

§

fn default() -> Cursor

Returns the “default value” for a type. Read more
Source§

impl From<And> for Cursor

Source§

fn from(value: And) -> Self

Converts to this type from the input type.
Source§

impl From<Any> for Cursor

Source§

fn from(value: Any) -> Self

Converts to this type from the input type.
Source§

impl From<At> for Cursor

Source§

fn from(value: At) -> Self

Converts to this type from the input type.
Source§

impl From<AtKeyword> for Cursor

Source§

fn from(value: AtKeyword) -> Self

Converts to this type from the input type.
Source§

impl From<Backtick> for Cursor

Source§

fn from(value: Backtick) -> Self

Converts to this type from the input type.
Source§

impl From<BadString> for Cursor

Source§

fn from(value: BadString) -> Self

Converts to this type from the input type.
Source§

impl From<BadUrl> for Cursor

Source§

fn from(value: BadUrl) -> Self

Converts to this type from the input type.
Source§

impl From<Bang> for Cursor

Source§

fn from(value: Bang) -> Self

Converts to this type from the input type.
Source§

impl From<Cap> for Cursor

Source§

fn from(value: Cap) -> Self

Converts to this type from the input type.
Source§

impl From<Caret> for Cursor

Source§

fn from(value: Caret) -> Self

Converts to this type from the input type.
Source§

impl From<CdcOrCdo> for Cursor

Source§

fn from(value: CdcOrCdo) -> Self

Converts to this type from the input type.
Source§

impl From<Ch> for Cursor

Source§

fn from(value: Ch) -> Self

Converts to this type from the input type.
Source§

impl From<Cm> for Cursor

Source§

fn from(value: Cm) -> Self

Converts to this type from the input type.
Source§

impl From<Colon> for Cursor

Source§

fn from(value: Colon) -> Self

Converts to this type from the input type.
Source§

impl From<Comma> for Cursor

Source§

fn from(value: Comma) -> Self

Converts to this type from the input type.
Source§

impl From<Comment> for Cursor

Source§

fn from(value: Comment) -> Self

Converts to this type from the input type.
Source§

impl From<ConditionKeyword> for Cursor

Source§

fn from(value: ConditionKeyword) -> Self

Converts to this type from the input type.
Source§

impl From<Cqb> for Cursor

Source§

fn from(value: Cqb) -> Self

Converts to this type from the input type.
Source§

impl From<Cqh> for Cursor

Source§

fn from(value: Cqh) -> Self

Converts to this type from the input type.
Source§

impl From<Cqi> for Cursor

Source§

fn from(value: Cqi) -> Self

Converts to this type from the input type.
Source§

impl From<Cqmax> for Cursor

Source§

fn from(value: Cqmax) -> Self

Converts to this type from the input type.
Source§

impl From<Cqmin> for Cursor

Source§

fn from(value: Cqmin) -> Self

Converts to this type from the input type.
Source§

impl From<Cqw> for Cursor

Source§

fn from(value: Cqw) -> Self

Converts to this type from the input type.
§

impl From<Cursor> for DimensionUnit

§

fn from(cursor: Cursor) -> DimensionUnit

Converts to this type from the input type.
§

impl From<Cursor> for Kind

§

fn from(cursor: Cursor) -> Kind

Converts to this type from the input type.
§

impl From<Cursor> for KindSet

§

fn from(cursor: Cursor) -> KindSet

Converts to this type from the input type.
§

impl From<Cursor> for QuoteStyle

§

fn from(cursor: Cursor) -> QuoteStyle

Converts to this type from the input type.
§

impl From<Cursor> for Span

§

fn from(cursor: Cursor) -> Span

Converts to this type from the input type.
§

impl From<Cursor> for Token

§

fn from(cursor: Cursor) -> Token

Converts to this type from the input type.
Source§

impl From<Dash> for Cursor

Source§

fn from(value: Dash) -> Self

Converts to this type from the input type.
Source§

impl From<DashedIdent> for Cursor

Source§

fn from(value: DashedIdent) -> Self

Converts to this type from the input type.
Source§

impl From<Db> for Cursor

Source§

fn from(value: Db) -> Self

Converts to this type from the input type.
Source§

impl From<Deg> for Cursor

Source§

fn from(value: Deg) -> Self

Converts to this type from the input type.
Source§

impl From<Delim> for Cursor

Source§

fn from(value: Delim) -> Self

Converts to this type from the input type.
Source§

impl From<Dimension> for Cursor

Source§

fn from(value: Dimension) -> Self

Converts to this type from the input type.
Source§

impl From<DimensionIdent> for Cursor

Source§

fn from(value: DimensionIdent) -> Self

Converts to this type from the input type.
Source§

impl From<Dollar> for Cursor

Source§

fn from(value: Dollar) -> Self

Converts to this type from the input type.
Source§

impl From<Dot> for Cursor

Source§

fn from(value: Dot) -> Self

Converts to this type from the input type.
Source§

impl From<Dpcm> for Cursor

Source§

fn from(value: Dpcm) -> Self

Converts to this type from the input type.
Source§

impl From<Dpi> for Cursor

Source§

fn from(value: Dpi) -> Self

Converts to this type from the input type.
Source§

impl From<Dppx> for Cursor

Source§

fn from(value: Dppx) -> Self

Converts to this type from the input type.
Source§

impl From<Dvb> for Cursor

Source§

fn from(value: Dvb) -> Self

Converts to this type from the input type.
Source§

impl From<Dvh> for Cursor

Source§

fn from(value: Dvh) -> Self

Converts to this type from the input type.
Source§

impl From<Dvi> for Cursor

Source§

fn from(value: Dvi) -> Self

Converts to this type from the input type.
Source§

impl From<Dvmax> for Cursor

Source§

fn from(value: Dvmax) -> Self

Converts to this type from the input type.
Source§

impl From<Dvmin> for Cursor

Source§

fn from(value: Dvmin) -> Self

Converts to this type from the input type.
Source§

impl From<Dvw> for Cursor

Source§

fn from(value: Dvw) -> Self

Converts to this type from the input type.
Source§

impl From<Em> for Cursor

Source§

fn from(value: Em) -> Self

Converts to this type from the input type.
Source§

impl From<Eof> for Cursor

Source§

fn from(value: Eof) -> Self

Converts to this type from the input type.
Source§

impl From<Eq> for Cursor

Source§

fn from(value: Eq) -> Self

Converts to this type from the input type.
Source§

impl From<Ex> for Cursor

Source§

fn from(value: Ex) -> Self

Converts to this type from the input type.
Source§

impl From<Fr> for Cursor

Source§

fn from(value: Fr) -> Self

Converts to this type from the input type.
Source§

impl From<Function> for Cursor

Source§

fn from(value: Function) -> Self

Converts to this type from the input type.
Source§

impl From<Grad> for Cursor

Source§

fn from(value: Grad) -> Self

Converts to this type from the input type.
Source§

impl From<Gt> for Cursor

Source§

fn from(value: Gt) -> Self

Converts to this type from the input type.
Source§

impl From<Hash> for Cursor

Source§

fn from(value: Hash) -> Self

Converts to this type from the input type.
Source§

impl From<Hash> for Cursor

Source§

fn from(value: Hash) -> Self

Converts to this type from the input type.
Source§

impl From<Hz> for Cursor

Source§

fn from(value: Hz) -> Self

Converts to this type from the input type.
Source§

impl From<Ic> for Cursor

Source§

fn from(value: Ic) -> Self

Converts to this type from the input type.
Source§

impl From<Ident> for Cursor

Source§

fn from(value: Ident) -> Self

Converts to this type from the input type.
Source§

impl From<In> for Cursor

Source§

fn from(value: In) -> Self

Converts to this type from the input type.
Source§

impl From<Khz> for Cursor

Source§

fn from(value: Khz) -> Self

Converts to this type from the input type.
Source§

impl From<LeftCurly> for Cursor

Source§

fn from(value: LeftCurly) -> Self

Converts to this type from the input type.
Source§

impl From<LeftParen> for Cursor

Source§

fn from(value: LeftParen) -> Self

Converts to this type from the input type.
Source§

impl From<LeftSquare> for Cursor

Source§

fn from(value: LeftSquare) -> Self

Converts to this type from the input type.
Source§

impl From<Lh> for Cursor

Source§

fn from(value: Lh) -> Self

Converts to this type from the input type.
Source§

impl From<Lt> for Cursor

Source§

fn from(value: Lt) -> Self

Converts to this type from the input type.
Source§

impl From<Lvb> for Cursor

Source§

fn from(value: Lvb) -> Self

Converts to this type from the input type.
Source§

impl From<Lvh> for Cursor

Source§

fn from(value: Lvh) -> Self

Converts to this type from the input type.
Source§

impl From<Lvi> for Cursor

Source§

fn from(value: Lvi) -> Self

Converts to this type from the input type.
Source§

impl From<Lvmax> for Cursor

Source§

fn from(value: Lvmax) -> Self

Converts to this type from the input type.
Source§

impl From<Lvmin> for Cursor

Source§

fn from(value: Lvmin) -> Self

Converts to this type from the input type.
Source§

impl From<Lvw> for Cursor

Source§

fn from(value: Lvw) -> Self

Converts to this type from the input type.
Source§

impl From<Mm> for Cursor

Source§

fn from(value: Mm) -> Self

Converts to this type from the input type.
Source§

impl From<Ms> for Cursor

Source§

fn from(value: Ms) -> Self

Converts to this type from the input type.
Source§

impl From<Number> for Cursor

Source§

fn from(value: Number) -> Self

Converts to this type from the input type.
Source§

impl From<Or> for Cursor

Source§

fn from(value: Or) -> Self

Converts to this type from the input type.
Source§

impl From<PairWiseEnd> for Cursor

Source§

fn from(value: PairWiseEnd) -> Self

Converts to this type from the input type.
Source§

impl From<PairWiseStart> for Cursor

Source§

fn from(value: PairWiseStart) -> Self

Converts to this type from the input type.
Source§

impl From<ParserCheckpoint> for Cursor

Source§

fn from(value: ParserCheckpoint) -> Self

Converts to this type from the input type.
Source§

impl From<Pc> for Cursor

Source§

fn from(value: Pc) -> Self

Converts to this type from the input type.
Source§

impl From<Percent> for Cursor

Source§

fn from(value: Percent) -> Self

Converts to this type from the input type.
Source§

impl From<Percent> for Cursor

Source§

fn from(value: Percent) -> Self

Converts to this type from the input type.
Source§

impl From<Plus> for Cursor

Source§

fn from(value: Plus) -> Self

Converts to this type from the input type.
Source§

impl From<Pt> for Cursor

Source§

fn from(value: Pt) -> Self

Converts to this type from the input type.
Source§

impl From<Px> for Cursor

Source§

fn from(value: Px) -> Self

Converts to this type from the input type.
Source§

impl From<Q> for Cursor

Source§

fn from(value: Q) -> Self

Converts to this type from the input type.
Source§

impl From<Question> for Cursor

Source§

fn from(value: Question) -> Self

Converts to this type from the input type.
Source§

impl From<Rad> for Cursor

Source§

fn from(value: Rad) -> Self

Converts to this type from the input type.
Source§

impl From<Rcap> for Cursor

Source§

fn from(value: Rcap) -> Self

Converts to this type from the input type.
Source§

impl From<Rch> for Cursor

Source§

fn from(value: Rch) -> Self

Converts to this type from the input type.
Source§

impl From<Rem> for Cursor

Source§

fn from(value: Rem) -> Self

Converts to this type from the input type.
Source§

impl From<Rex> for Cursor

Source§

fn from(value: Rex) -> Self

Converts to this type from the input type.
Source§

impl From<Ric> for Cursor

Source§

fn from(value: Ric) -> Self

Converts to this type from the input type.
Source§

impl From<RightCurly> for Cursor

Source§

fn from(value: RightCurly) -> Self

Converts to this type from the input type.
Source§

impl From<RightParen> for Cursor

Source§

fn from(value: RightParen) -> Self

Converts to this type from the input type.
Source§

impl From<RightSquare> for Cursor

Source§

fn from(value: RightSquare) -> Self

Converts to this type from the input type.
Source§

impl From<Rlh> for Cursor

Source§

fn from(value: Rlh) -> Self

Converts to this type from the input type.
Source§

impl From<S> for Cursor

Source§

fn from(value: S) -> Self

Converts to this type from the input type.
Source§

impl From<Semicolon> for Cursor

Source§

fn from(value: Semicolon) -> Self

Converts to this type from the input type.
Source§

impl From<Slash> for Cursor

Source§

fn from(value: Slash) -> Self

Converts to this type from the input type.
Source§

impl From<Star> for Cursor

Source§

fn from(value: Star) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Cursor

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<Svb> for Cursor

Source§

fn from(value: Svb) -> Self

Converts to this type from the input type.
Source§

impl From<Svh> for Cursor

Source§

fn from(value: Svh) -> Self

Converts to this type from the input type.
Source§

impl From<Svi> for Cursor

Source§

fn from(value: Svi) -> Self

Converts to this type from the input type.
Source§

impl From<Svmax> for Cursor

Source§

fn from(value: Svmax) -> Self

Converts to this type from the input type.
Source§

impl From<Svmin> for Cursor

Source§

fn from(value: Svmin) -> Self

Converts to this type from the input type.
Source§

impl From<Svw> for Cursor

Source§

fn from(value: Svw) -> Self

Converts to this type from the input type.
Source§

impl From<Tilde> for Cursor

Source§

fn from(value: Tilde) -> Self

Converts to this type from the input type.
Source§

impl From<Turn> for Cursor

Source§

fn from(value: Turn) -> Self

Converts to this type from the input type.
Source§

impl From<Underscore> for Cursor

Source§

fn from(value: Underscore) -> Self

Converts to this type from the input type.
Source§

impl From<Url> for Cursor

Source§

fn from(value: Url) -> Self

Converts to this type from the input type.
Source§

impl From<Vb> for Cursor

Source§

fn from(value: Vb) -> Self

Converts to this type from the input type.
Source§

impl From<Vh> for Cursor

Source§

fn from(value: Vh) -> Self

Converts to this type from the input type.
Source§

impl From<Vi> for Cursor

Source§

fn from(value: Vi) -> Self

Converts to this type from the input type.
Source§

impl From<Vmax> for Cursor

Source§

fn from(value: Vmax) -> Self

Converts to this type from the input type.
Source§

impl From<Vmin> for Cursor

Source§

fn from(value: Vmin) -> Self

Converts to this type from the input type.
Source§

impl From<Vw> for Cursor

Source§

fn from(value: Vw) -> Self

Converts to this type from the input type.
Source§

impl From<Whitespace> for Cursor

Source§

fn from(value: Whitespace) -> Self

Converts to this type from the input type.
Source§

impl From<X> for Cursor

Source§

fn from(value: X) -> Self

Converts to this type from the input type.
§

impl Hash for Cursor

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Ord for Cursor

§

fn cmp(&self, other: &Cursor) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl PartialEq<AssociatedWhitespaceRules> for Cursor

§

fn eq(&self, other: &AssociatedWhitespaceRules) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<CommentStyle> for &Cursor

§

fn eq(&self, other: &CommentStyle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<CommentStyle> for Cursor

§

fn eq(&self, other: &CommentStyle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<DimensionUnit> for &Cursor

§

fn eq(&self, other: &DimensionUnit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<DimensionUnit> for Cursor

§

fn eq(&self, other: &DimensionUnit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Kind> for &Cursor

§

fn eq(&self, other: &Kind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Kind> for Cursor

§

fn eq(&self, other: &Kind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<KindSet> for &Cursor

§

fn eq(&self, other: &KindSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<KindSet> for Cursor

§

fn eq(&self, other: &KindSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<QuoteStyle> for &Cursor

§

fn eq(&self, other: &QuoteStyle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<QuoteStyle> for Cursor

§

fn eq(&self, other: &QuoteStyle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Span> for Cursor

§

fn eq(&self, other: &Span) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Token> for Cursor

§

fn eq(&self, other: &Token) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<char> for &Cursor

§

fn eq(&self, other: &char) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<char> for Cursor

§

fn eq(&self, other: &char) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for Cursor

§

fn eq(&self, other: &Cursor) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd for Cursor

§

fn partial_cmp(&self, other: &Cursor) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl Serialize for Cursor

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl ToSpan for Cursor

§

fn to_span(&self) -> Span

§

impl Copy for Cursor

§

impl Eq for Cursor

§

impl StructuralPartialEq for Cursor

Auto Trait Implementations§

§

impl Freeze for Cursor

§

impl RefUnwindSafe for Cursor

§

impl Send for Cursor

§

impl Sync for Cursor

§

impl Unpin for Cursor

§

impl UnwindSafe for Cursor

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either [OwoColorize::fg] or a color-specific method, such as [OwoColorize::green], Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either [OwoColorize::bg] or a color-specific method, such as [OwoColorize::on_yellow], Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.