Expr

Enum Expr 

Source
pub enum Expr {
Show 65 variants Literal(Literal), Path(TypePath), Binary { left: Box<Expr>, op: BinOp, right: Box<Expr>, }, Unary { op: UnaryOp, expr: Box<Expr>, }, Pipe { expr: Box<Expr>, operations: Vec<PipeOp>, }, Incorporation { segments: Vec<IncorporationSegment>, }, Morpheme { kind: MorphemeKind, body: Box<Expr>, }, Call { func: Box<Expr>, args: Vec<Expr>, }, MethodCall { receiver: Box<Expr>, method: Ident, type_args: Option<Vec<TypeExpr>>, args: Vec<Expr>, }, Field { expr: Box<Expr>, field: Ident, }, Index { expr: Box<Expr>, index: Box<Expr>, }, Array(Vec<Expr>), ArrayRepeat { value: Box<Expr>, count: Box<Expr>, }, Tuple(Vec<Expr>), Struct { path: TypePath, fields: Vec<FieldInit>, rest: Option<Box<Expr>>, }, Block(Block), If { condition: Box<Expr>, then_branch: Block, else_branch: Option<Box<Expr>>, }, Match { expr: Box<Expr>, arms: Vec<MatchArm>, }, Loop { label: Option<Ident>, body: Block, }, While { label: Option<Ident>, condition: Box<Expr>, body: Block, }, For { label: Option<Ident>, pattern: Pattern, iter: Box<Expr>, body: Block, }, Closure { params: Vec<ClosureParam>, return_type: Option<TypeExpr>, body: Box<Expr>, is_move: bool, }, Await { expr: Box<Expr>, evidentiality: Option<Evidentiality>, }, Try(Box<Expr>), Return(Option<Box<Expr>>), Break { label: Option<Ident>, value: Option<Box<Expr>>, }, Continue { label: Option<Ident>, }, Range { start: Option<Box<Expr>>, end: Option<Box<Expr>>, inclusive: bool, }, Macro { path: TypePath, tokens: String, }, Evidential { expr: Box<Expr>, evidentiality: Evidentiality, }, Assign { target: Box<Expr>, value: Box<Expr>, }, Let { pattern: Pattern, value: Box<Expr>, }, Unsafe(Block), Async { block: Block, is_move: bool, }, Deref(Box<Expr>), AddrOf { mutable: bool, expr: Box<Expr>, }, Cast { expr: Box<Expr>, ty: TypeExpr, }, InlineAsm(InlineAsm), VolatileRead { ptr: Box<Expr>, ty: Option<TypeExpr>, }, VolatileWrite { ptr: Box<Expr>, value: Box<Expr>, ty: Option<TypeExpr>, }, SimdLiteral { elements: Vec<Expr>, ty: Option<TypeExpr>, }, SimdIntrinsic { op: SimdOp, args: Vec<Expr>, }, SimdShuffle { a: Box<Expr>, b: Box<Expr>, indices: Vec<u8>, }, SimdSplat { value: Box<Expr>, lanes: u8, }, SimdExtract { vector: Box<Expr>, index: u8, }, SimdInsert { vector: Box<Expr>, index: u8, value: Box<Expr>, }, AtomicOp { op: AtomicOp, ptr: Box<Expr>, value: Option<Box<Expr>>, expected: Option<Box<Expr>>, ordering: MemoryOrdering, failure_ordering: Option<MemoryOrdering>, }, AtomicFence { ordering: MemoryOrdering, }, HttpRequest { method: HttpMethod, url: Box<Expr>, headers: Vec<(Expr, Expr)>, body: Option<Box<Expr>>, timeout: Option<Box<Expr>>, }, GrpcCall { service: Box<Expr>, method: Box<Expr>, message: Option<Box<Expr>>, metadata: Vec<(Expr, Expr)>, timeout: Option<Box<Expr>>, }, WebSocketConnect { url: Box<Expr>, protocols: Vec<Expr>, headers: Vec<(Expr, Expr)>, }, WebSocketMessage { kind: WebSocketMessageKind, data: Box<Expr>, }, KafkaOp { kind: KafkaOpKind, topic: Box<Expr>, payload: Option<Box<Expr>>, key: Option<Box<Expr>>, partition: Option<Box<Expr>>, }, GraphQLOp { kind: GraphQLOpKind, document: Box<Expr>, variables: Option<Box<Expr>>, operation_name: Option<Box<Expr>>, }, ProtocolStream { protocol: ProtocolKind, source: Box<Expr>, config: Option<Box<Expr>>, }, LegionFieldVar { name: Ident, }, LegionSuperposition { field: Box<Expr>, pattern: Box<Expr>, }, LegionInterference { query: Box<Expr>, field: Box<Expr>, }, LegionResonance { expr: Box<Expr>, }, LegionDistribute { task: Box<Expr>, count: Box<Expr>, }, LegionGather { fragments: Box<Expr>, }, LegionBroadcast { signal: Box<Expr>, target: Box<Expr>, }, LegionConsensus { contributions: Box<Expr>, }, LegionDecay { field: Box<Expr>, rate: Box<Expr>, }, NamedArg { name: Ident, value: Box<Expr>, },
}
Expand description

Expressions.

Variants§

§

Literal(Literal)

Literal value

§

Path(TypePath)

Variable reference

§

Binary

Binary operation

Fields

§left: Box<Expr>
§right: Box<Expr>
§

Unary

Unary operation

Fields

§expr: Box<Expr>
§

Pipe

Pipe expression: x|f|g

Fields

§expr: Box<Expr>
§operations: Vec<PipeOp>
§

Incorporation

Incorporation: file·open·read

Fields

§

Morpheme

Morpheme application: τ{f}

Fields

§body: Box<Expr>
§

Call

Function call

Fields

§func: Box<Expr>
§args: Vec<Expr>
§

MethodCall

Method call

Fields

§receiver: Box<Expr>
§method: Ident
§type_args: Option<Vec<TypeExpr>>

Turbofish type arguments: method::<T, U>(args)

§args: Vec<Expr>
§

Field

Field access

Fields

§expr: Box<Expr>
§field: Ident
§

Index

Index: arr[i]

Fields

§expr: Box<Expr>
§index: Box<Expr>
§

Array(Vec<Expr>)

Array literal

§

ArrayRepeat

Array repeat literal: [value; count]

Fields

§value: Box<Expr>
§count: Box<Expr>
§

Tuple(Vec<Expr>)

Tuple literal

§

Struct

Struct literal

Fields

§fields: Vec<FieldInit>
§rest: Option<Box<Expr>>
§

Block(Block)

Block expression

§

If

If expression

Fields

§condition: Box<Expr>
§then_branch: Block
§else_branch: Option<Box<Expr>>
§

Match

Match expression

Fields

§expr: Box<Expr>
§

Loop

Loop with optional label: 'label: loop { ... }

Fields

§label: Option<Ident>
§body: Block
§

While

While loop with optional label: 'label: while cond { ... }

Fields

§label: Option<Ident>
§condition: Box<Expr>
§body: Block
§

For

For loop with optional label: 'label: for x in iter { ... }

Fields

§label: Option<Ident>
§pattern: Pattern
§iter: Box<Expr>
§body: Block
§

Closure

Closure: {x => x + 1} or |x| x + 1 or move |x| x + 1 or |x| -> T { ... }

Fields

§return_type: Option<TypeExpr>

Optional explicit return type annotation: |x| -> i32 { x + 1 }

§body: Box<Expr>
§is_move: bool

Whether this is a move closure that takes ownership of captured variables

§

Await

Await with optional evidentiality: expr⌛ or expr⌛? or expr⌛! or expr⌛~ The evidentiality marker specifies how to handle the awaited result:

  • ⌛? - await and propagate error (uncertain)
  • ⌛! - await, expect success (known/infallible)
  • ⌛~ - await external/reported source
  • ⌛‽ - await with trust boundary crossing

Fields

§expr: Box<Expr>
§evidentiality: Option<Evidentiality>
§

Try(Box<Expr>)

Try: expr?

§

Return(Option<Box<Expr>>)

Return

§

Break

Break with optional label and value: break 'label value

Fields

§label: Option<Ident>
§value: Option<Box<Expr>>
§

Continue

Continue with optional label: continue 'label

Fields

§label: Option<Ident>
§

Range

Range: a..b or a..=b

Fields

§start: Option<Box<Expr>>
§inclusive: bool
§

Macro

Macro invocation

Fields

§tokens: String
§

Evidential

With evidentiality marker

Fields

§expr: Box<Expr>
§evidentiality: Evidentiality
§

Assign

Assignment: x = value

Fields

§target: Box<Expr>
§value: Box<Expr>
§

Let

Let expression (for if-let, while-let patterns): let pattern = expr

Fields

§pattern: Pattern
§value: Box<Expr>
§

Unsafe(Block)

Unsafe block: unsafe { ... }

§

Async

Async block: async { ... } or async move { ... }

Fields

§block: Block
§is_move: bool
§

Deref(Box<Expr>)

Raw pointer dereference: *ptr

§

AddrOf

Address-of: &expr or &mut expr

Fields

§mutable: bool
§expr: Box<Expr>
§

Cast

Cast: expr as Type

Fields

§expr: Box<Expr>
§

InlineAsm(InlineAsm)

Inline assembly: asm!("instruction", ...)

§

VolatileRead

Volatile read: volatile read<T>(ptr) or volatile read(ptr)

Fields

§ptr: Box<Expr>
§

VolatileWrite

Volatile write: volatile write<T>(ptr, value) or volatile write(ptr, value)

Fields

§ptr: Box<Expr>
§value: Box<Expr>
§

SimdLiteral

SIMD vector literal: simd[1.0, 2.0, 3.0, 4.0]

Fields

§elements: Vec<Expr>
§

SimdIntrinsic

SIMD intrinsic operation: simd::add(a, b)

Fields

§args: Vec<Expr>
§

SimdShuffle

SIMD shuffle: simd::shuffle(a, b, [0, 4, 1, 5])

Fields

§indices: Vec<u8>
§

SimdSplat

SIMD splat (broadcast scalar to all lanes): simd::splat(x)

Fields

§value: Box<Expr>
§lanes: u8
§

SimdExtract

SIMD extract single lane: simd::extract(v, 0)

Fields

§vector: Box<Expr>
§index: u8
§

SimdInsert

SIMD insert into lane: simd::insert(v, 0, value)

Fields

§vector: Box<Expr>
§index: u8
§value: Box<Expr>
§

AtomicOp

Atomic operation: atomic::load(&x, Ordering::SeqCst)

Fields

§ptr: Box<Expr>
§value: Option<Box<Expr>>
§expected: Option<Box<Expr>>
§failure_ordering: Option<MemoryOrdering>
§

AtomicFence

Atomic fence: atomic::fence(Ordering::SeqCst)

Fields

§

HttpRequest

HTTP request: http·get(url), http·post(url), etc. Incorporation pattern for building HTTP requests

Fields

§method: HttpMethod
§url: Box<Expr>
§headers: Vec<(Expr, Expr)>
§body: Option<Box<Expr>>
§timeout: Option<Box<Expr>>
§

GrpcCall

gRPC call: grpc·call(service, method) Incorporation pattern for gRPC operations

Fields

§service: Box<Expr>
§method: Box<Expr>
§message: Option<Box<Expr>>
§metadata: Vec<(Expr, Expr)>
§timeout: Option<Box<Expr>>
§

WebSocketConnect

WebSocket connection: ws·connect(url) Incorporation pattern for WebSocket operations

Fields

§url: Box<Expr>
§protocols: Vec<Expr>
§headers: Vec<(Expr, Expr)>
§

WebSocketMessage

WebSocket message: ws·message(data) or ws·text(str) / ws·binary(bytes)

§

KafkaOp

Kafka operation: kafka·produce(topic, message), kafka·consume(topic)

Fields

§topic: Box<Expr>
§payload: Option<Box<Expr>>
§partition: Option<Box<Expr>>
§

GraphQLOp

GraphQL query: graphql·query(document) or graphql·mutation(document)

Fields

§document: Box<Expr>
§variables: Option<Box<Expr>>
§operation_name: Option<Box<Expr>>
§

ProtocolStream

Protocol stream: iterable over network messages http·stream(url), ws·stream(), kafka·stream(topic)

Fields

§protocol: ProtocolKind
§source: Box<Expr>
§config: Option<Box<Expr>>
§

LegionFieldVar

Legion field variable: memory∿ The ∿ suffix indicates a LegionField collective memory type

Fields

§name: Ident
§

LegionSuperposition

Superposition: field∿ ⊕= pattern Pattern joins the collective memory

Fields

§field: Box<Expr>
§pattern: Box<Expr>
§

LegionInterference

Interference query: query ⫰ field∿ Query the collective memory via interference

Fields

§query: Box<Expr>
§field: Box<Expr>
§

LegionResonance

Resonance extraction: resonance~ |◉ Extract agreement peaks from interference pattern

Fields

§expr: Box<Expr>
§

LegionDistribute

Distribute: task ⟁ agent_count Fragment task holographically across agents

Fields

§task: Box<Expr>
§count: Box<Expr>
§

LegionGather

Gather: fragments ⟀ Unify fragments via interference

Fields

§fragments: Box<Expr>
§

LegionBroadcast

Broadcast: signal ↠ legion Send signal to all agents

Fields

§signal: Box<Expr>
§target: Box<Expr>
§

LegionConsensus

Consensus: contributions ⇢ Achieve consensus from multiple contributions

Fields

§contributions: Box<Expr>
§

LegionDecay

Decay: field∿ ∂= rate Apply decay to collective memory

Fields

§field: Box<Expr>
§rate: Box<Expr>
§

NamedArg

Named argument in function call: name: value Used in calls like stack(axis: 0) or func(x: 1, y: 2)

Fields

§name: Ident
§value: Box<Expr>

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Expr

Source§

fn eq(&self, other: &Expr) -> 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.
Source§

impl StructuralPartialEq for Expr

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnwindSafe for Expr

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

§Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
Source§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
Source§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
Source§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
Source§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
Source§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
Source§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
Source§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
Source§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
Source§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
Source§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
Source§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
Source§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
Source§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
Source§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
Source§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
Source§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
Source§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
Source§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
Source§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
Source§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

§Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
Source§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
Source§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
Source§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
Source§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
Source§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
Source§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
Source§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
Source§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
Source§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
Source§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
Source§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
Source§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
Source§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
Source§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
Source§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
Source§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
Source§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
Source§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
Source§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
Source§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling Attribute value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

§Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
Source§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
Source§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
Source§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
Source§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
Source§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
Source§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
Source§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
Source§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi Quirk value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

§Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
Source§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
Source§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
Source§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
Source§

fn clear(&self) -> Painted<&T>

👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear(). The clear() method will be removed in a future release.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
Source§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
Source§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
Source§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
Source§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the Condition value applies. Replaces any previous condition.

See the crate level docs for more details.

§Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new Painted with a default Style. Read more
Source§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T