Instruction

Enum Instruction 

Source
pub enum Instruction {
Show 134 variants End, Work { amount: u32, }, Spawn { code: Vec<Instruction>, dest: Register, }, SpawnLink { code: Vec<Instruction>, dest: Register, }, Send { to: Source, msg: String, }, Receive { dest: Register, }, ReceiveTimeout { dest: Register, timeout: u32, }, Link { target: Source, }, Unlink { target: Source, }, Monitor { target: Source, dest: Register, }, Demonitor { monitor_ref: Register, }, Register { name: String, }, Unregister { name: String, }, WhereIs { name: String, dest: Register, }, Print { source: Source, }, Crash, Exit { reason: Register, }, TrapExit { enable: bool, }, LoadInt { value: i64, dest: Register, }, Move { source: Register, dest: Register, }, Add { a: Operand, b: Operand, dest: Register, }, Sub { a: Operand, b: Operand, dest: Register, }, Mul { a: Operand, b: Operand, dest: Register, }, Div { a: Operand, b: Operand, dest: Register, }, Mod { a: Operand, b: Operand, dest: Register, }, Eq { a: Operand, b: Operand, dest: Register, }, Ne { a: Operand, b: Operand, dest: Register, }, Lt { a: Operand, b: Operand, dest: Register, }, Lte { a: Operand, b: Operand, dest: Register, }, Gt { a: Operand, b: Operand, dest: Register, }, Gte { a: Operand, b: Operand, dest: Register, }, Jump { target: usize, }, JumpIf { cond: Operand, target: usize, }, JumpUnless { cond: Operand, target: usize, }, Call { target: usize, }, Return, CallMFA { module: String, function: String, arity: u8, }, CallLocal { function: String, arity: u8, }, TailCallMFA { module: String, function: String, arity: u8, }, TailCallLocal { function: String, arity: u8, }, MakeFun { module: String, function: String, arity: u8, dest: Register, }, Apply { fun: Register, arity: u8, }, MakeClosure { module: String, function: String, arity: u8, captures: Vec<Register>, dest: Register, }, SpawnMFA { module: String, function: String, arity: u8, dest: Register, }, SpawnLinkMFA { module: String, function: String, arity: u8, dest: Register, }, Push { source: Operand, }, Pop { dest: Register, }, LoadAtom { name: String, dest: Register, }, MakeTuple { arity: u8, dest: Register, }, TupleElement { tuple: Register, index: u8, dest: Register, }, TupleArity { tuple: Register, dest: Register, }, Match { source: Register, pattern: Pattern, fail_target: usize, }, ReceiveMatch { clauses: Vec<(Pattern, usize)>, timeout: Option<u32>, timeout_target: usize, }, MakeList { length: u8, dest: Register, }, Cons { head: Register, tail: Register, dest: Register, }, ListHead { list: Register, dest: Register, }, ListTail { list: Register, dest: Register, }, ListIsEmpty { list: Register, dest: Register, }, ListLength { list: Register, dest: Register, }, ListAppend { a: Register, b: Register, dest: Register, }, ListReverse { list: Register, dest: Register, }, ListNth { list: Register, n: Register, dest: Register, }, ListMember { elem: Register, list: Register, dest: Register, }, IsInteger { source: Register, dest: Register, }, IsAtom { source: Register, dest: Register, }, IsTuple { source: Register, dest: Register, }, IsList { source: Register, dest: Register, }, IsPid { source: Register, dest: Register, }, IsFunction { source: Register, dest: Register, }, IsString { source: Register, dest: Register, }, IsMap { source: Register, dest: Register, }, PutDict { key: Register, value: Register, dest: Register, }, GetDict { key: Register, dest: Register, }, EraseDict { key: Register, dest: Register, }, GetDictKeys { dest: Register, }, MakeMap { count: u8, dest: Register, }, MapGet { map: Register, key: Register, dest: Register, }, MapGetDefault { map: Register, key: Register, default: Register, dest: Register, }, MapPut { map: Register, key: Register, value: Register, dest: Register, }, MapRemove { map: Register, key: Register, dest: Register, }, MapHas { map: Register, key: Register, dest: Register, }, MapSize { map: Register, dest: Register, }, MapKeys { map: Register, dest: Register, }, MapValues { map: Register, dest: Register, }, MakeBinary { bytes: Vec<u8>, dest: Register, }, BinarySize { bin: Register, dest: Register, }, BinaryAt { bin: Register, index: Register, dest: Register, }, BinarySlice { bin: Register, start: Register, len: Register, dest: Register, }, BinaryConcat { a: Register, b: Register, dest: Register, }, IsBinary { source: Register, dest: Register, }, StringToBinary { source: Register, dest: Register, }, BinaryToString { source: Register, dest: Register, }, BinaryConstructSegments { segments: Vec<(SegmentSource, BitSegment)>, dest: Register, }, BinaryMatchStart { source: Register, }, BinaryMatchSegment { segment: BitSegment, dest: Register, fail_target: usize, }, BinaryMatchRest { dest: Register, }, BinaryGetInteger { bin: Register, bit_offset: Register, segment: BitSegment, dest: Register, }, BinaryPutInteger { bin: Register, bit_offset: Register, value: Register, segment: BitSegment, dest: Register, }, MakeRef { dest: Register, }, IsRef { source: Register, dest: Register, }, LoadFloat { value: f64, dest: Register, }, IsFloat { source: Register, dest: Register, }, IntToFloat { source: Register, dest: Register, }, FloatToInt { source: Register, dest: Register, }, Floor { source: Register, dest: Register, }, Ceil { source: Register, dest: Register, }, Round { source: Register, dest: Register, }, Trunc { source: Register, dest: Register, }, Sqrt { source: Register, dest: Register, }, Abs { source: Register, dest: Register, }, Pow { base: Register, exp: Register, dest: Register, }, SendAfter { delay: u32, to: Source, msg: Register, dest: Register, }, StartTimer { delay: u32, msg: Register, dest: Register, }, CancelTimer { timer_ref: Register, dest: Register, }, ReadTimer { timer_ref: Register, dest: Register, }, PrintLn { source: Register, }, ReadLine { dest: Register, }, FileRead { path: Register, dest: Register, }, FileWrite { path: Register, content: Register, dest: Register, }, FileExists { path: Register, dest: Register, }, FileDelete { path: Register, dest: Register, }, SelfPid { dest: Register, }, ProcessList { dest: Register, }, ProcessCount { dest: Register, }, IsAlive { pid: Register, dest: Register, }, ProcessInfo { pid: Register, dest: Register, }, ModuleList { dest: Register, }, FunctionExported { module: Register, function: Register, arity: Register, dest: Register, }, Try { catch_target: usize, after_target: Option<usize>, }, EndTry, Throw { class: Register, reason: Register, }, GetException { dest: Register, }, ClearException, Reraise,
}
Expand description

Bytecode instructions

Variants§

§

End

Process is done

§

Work

Do some work (costs amount reductions)

Fields

§amount: u32
§

Spawn

Spawn a new process running code, store child PID in register

Fields

Spawn a new process and atomically link to it

Fields

§

Send

Send a message to a process

Fields

§

Receive

Receive a message matching a pattern, block if none available For now, just receives any user message into a register

Fields

§

ReceiveTimeout

Receive with timeout (in reductions). If no message arrives before timeout expires, receives “TIMEOUT” instead.

Fields

§timeout: u32

Link to another process (bidirectional crash notification)

Fields

§target: Source

Remove a bidirectional link to another process

Fields

§target: Source
§

Monitor

Monitor another process (one-way crash notification) Returns a monitor reference in dest for later demonitoring

Fields

§target: Source
§

Demonitor

Cancel a monitor by its reference

Fields

§monitor_ref: Register
§

Register

Register current process with a name

Fields

§name: String
§

Unregister

Unregister a name

Fields

§name: String
§

WhereIs

Look up a registered name, store PID (or None) in register

Fields

§name: String
§

Print

Print a value (for debugging)

Fields

§source: Source
§

Crash

Crash the process (for testing links)

§

Exit

Exit the process with a reason (from register) If reason is :normal, linked processes are not signaled (unless they trap_exit) If reason is abnormal, linked processes receive exit signal

Fields

§reason: Register
§

TrapExit

Set the trap_exit flag for this process When true, exit signals from linked processes become {:EXIT, Pid, Reason} messages When false (default), abnormal exit signals kill this process

Fields

§enable: bool
§

LoadInt

Load an immediate integer into a register

Fields

§value: i64
§

Move

Move (copy) any value from source register to dest register

Fields

§source: Register
§

Add

Add two operands, store result in dest

§

Sub

Subtract b from a, store result in dest

§

Mul

Multiply two operands, store result in dest

§

Div

Divide a by b, store result in dest (integer division)

§

Mod

Modulo a by b, store result in dest

§

Eq

Compare equal: dest = (a == b) ? 1 : 0

§

Ne

Compare not equal: dest = (a != b) ? 1 : 0

§

Lt

Compare less than: dest = (a < b) ? 1 : 0

§

Lte

Compare less than or equal: dest = (a <= b) ? 1 : 0

§

Gt

Compare greater than: dest = (a > b) ? 1 : 0

§

Gte

Compare greater than or equal: dest = (a >= b) ? 1 : 0

§

Jump

Unconditional jump to instruction index

Fields

§target: usize
§

JumpIf

Jump to target if condition is truthy (non-zero integer)

Fields

§cond: Operand
§target: usize
§

JumpUnless

Jump to target if condition is falsy (zero or non-integer)

Fields

§cond: Operand
§target: usize
§

Call

Call a function: push return address onto call stack, jump to target

Fields

§target: usize
§

Return

Return from function: pop return address from call stack, jump to it If call stack is empty, ends the process

§

CallMFA

Call a function by MFA (Module:Function/Arity) Arguments must be in R0..R(arity-1) before call Return value will be in R0

Fields

§module: String
§function: String
§arity: u8
§

CallLocal

Call a local function in the current module More efficient than CallMFA when calling within same module

Fields

§function: String
§arity: u8
§

TailCallMFA

Tail call MFA - call without pushing return frame

Fields

§module: String
§function: String
§arity: u8
§

TailCallLocal

Tail call local - call without pushing return frame

Fields

§function: String
§arity: u8
§

MakeFun

Create a function reference and store in register

Fields

§module: String
§function: String
§arity: u8
§

Apply

Apply a function reference (from register) to arguments Fun must be a Value::Fun or Value::Closure in the specified register Arguments in R0..R(arity-1)

Fields

§arity: u8
§

MakeClosure

Create a closure capturing values from registers The closure references module:function but captures current register values When applied, captured values are placed after explicit arguments

Fields

§module: String
§function: String
§arity: u8
§captures: Vec<Register>
§

SpawnMFA

Spawn a process running module:function/arity Arguments for the function must be in R0..R(arity-1)

Fields

§module: String
§function: String
§arity: u8
§

SpawnLinkMFA

Spawn and link, running module:function/arity

Fields

§module: String
§function: String
§arity: u8
§

Push

Push a value onto the data stack

Fields

§source: Operand
§

Pop

Pop a value from the data stack into a register Crashes if stack is empty

Fields

§

LoadAtom

Load an atom into a register

Fields

§name: String
§

MakeTuple

Create a tuple from the top arity stack elements Elements are popped in reverse order (first pushed = first element)

Fields

§arity: u8
§

TupleElement

Get an element from a tuple by index (0-based) Crashes if not a tuple or index out of bounds

Fields

§tuple: Register
§index: u8
§

TupleArity

Get the arity (size) of a tuple Crashes if not a tuple

Fields

§tuple: Register
§

Match

Match a value against a pattern On success: binds variables and continues to next instruction On failure: jumps to fail_target

Fields

§source: Register
§pattern: Pattern
§fail_target: usize
§

ReceiveMatch

Receive with pattern matching Scans mailbox for first message matching any clause pattern. On match: removes message, binds variables, jumps to clause target. No match: blocks until a message arrives. Timeout: if set and expires, jumps to timeout_target.

Fields

§clauses: Vec<(Pattern, usize)>

List of (pattern, jump_target) clauses

§timeout: Option<u32>

Optional timeout in reductions

§timeout_target: usize

Where to jump on timeout

§

MakeList

Create a list from the top length stack elements Elements are popped in reverse order (first pushed = first element)

Fields

§length: u8
§

Cons

Cons: prepend an element to a list [elem | list] Crashes if tail is not a list

Fields

§

ListHead

Get the head (first element) of a list Crashes if not a list or empty

Fields

§

ListTail

Get the tail (rest) of a list Crashes if not a list or empty

Fields

§

ListIsEmpty

Check if a list is empty, store 1 (true) or 0 (false)

Fields

§

ListLength

Get the length of a list (O(n))

Fields

§

ListAppend

Append two lists (a ++ b) Crashes if either is not a list

§

ListReverse

Reverse a list Crashes if not a list

Fields

§

ListNth

Get the nth element of a list (0-based) Crashes if not a list or index out of bounds

Fields

§

ListMember

Check if an element is a member of a list Stores 1 (true) or 0 (false)

Fields

§

IsInteger

Check if value is an integer Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IsAtom

Check if value is an atom Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IsTuple

Check if value is a tuple Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IsList

Check if value is a list (including empty list) Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IsPid

Check if value is a PID Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IsFunction

Check if value is a function (Fun or Closure) Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IsString

Check if value is a string/binary Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IsMap

Check if value is a map Stores 1 (true) or 0 (false)

Fields

§source: Register
§

PutDict

Store value in process dictionary, returns old value (or None) in dest

Fields

§value: Register
§

GetDict

Get value from process dictionary, stores None if key not found

Fields

§

EraseDict

Remove key from process dictionary, returns old value (or None) in dest

Fields

§

GetDictKeys

Get all keys from process dictionary as a list

Fields

§

MakeMap

Create a map from key-value pairs on the stack Pops count pairs (2*count values: k1, v1, k2, v2, …) from stack

Fields

§count: u8
§

MapGet

Get value from map by key, crashes if key not found

Fields

§

MapGetDefault

Get value from map by key, returns default if not found

Fields

§default: Register
§

MapPut

Insert/update key-value in map, returns new map (maps are immutable)

Fields

§value: Register
§

MapRemove

Remove key from map, returns new map (maps are immutable)

Fields

§

MapHas

Check if key exists in map, stores 1 (true) or 0 (false)

Fields

§

MapSize

Get number of entries in map

Fields

§

MapKeys

Get all keys from map as a list

Fields

§

MapValues

Get all values from map as a list

Fields

§

MakeBinary

Create a binary from literal bytes

Fields

§bytes: Vec<u8>
§

BinarySize

Get the size (byte length) of a binary

Fields

§

BinaryAt

Get a byte at index (0-based) Crashes if not a binary or index out of bounds

Fields

§index: Register
§

BinarySlice

Extract a slice from a binary Crashes if not a binary or range out of bounds

Fields

§start: Register
§

BinaryConcat

Concatenate two binaries Crashes if either is not a binary

§

IsBinary

Check if value is a binary Stores 1 (true) or 0 (false)

Fields

§source: Register
§

StringToBinary

Convert a string to a binary (UTF-8 encoded)

Fields

§source: Register
§

BinaryToString

Convert a binary to a string (assumes UTF-8) Crashes if binary is not valid UTF-8

Fields

§source: Register
§

BinaryConstructSegments

Construct a binary from segments Each segment specifies a value, type, size, endianness, and signedness Usage: push segment values to stack, then call with segment specs

Fields

§segments: Vec<(SegmentSource, BitSegment)>

Segment specifications (in order)

§dest: Register

Destination register for the constructed binary

§

BinaryMatchStart

Start matching a binary - prepares for segment extraction Stores match state (current position) internally

Fields

§source: Register

Source binary to match

§

BinaryMatchSegment

Match a segment from the binary at current position Advances the match position by the segment size Jumps to fail_target if match fails (not enough bytes, etc.)

Fields

§segment: BitSegment

Segment specification

§dest: Register

Destination register for extracted value

§fail_target: usize

Jump target if match fails

§

BinaryMatchRest

Get the remaining bytes after matching Returns the rest of the binary as a new binary value

Fields

§dest: Register

Destination register for remaining bytes

§

BinaryGetInteger

Get an integer from a binary at bit offset with specified segment For random access bit extraction

Fields

§bin: Register

Source binary

§bit_offset: Register

Bit offset (from start)

§segment: BitSegment

Segment specification

§dest: Register

Destination register

§

BinaryPutInteger

Put an integer into a binary at bit offset with specified segment Creates a new binary with the value inserted

Fields

§bin: Register

Source binary

§bit_offset: Register

Bit offset (from start)

§value: Register

Value to insert

§segment: BitSegment

Segment specification

§dest: Register

Destination register

§

MakeRef

Create a new unique reference

Fields

§

IsRef

Check if value is a reference Stores 1 (true) or 0 (false)

Fields

§source: Register
§

LoadFloat

Load a floating-point immediate into a register

Fields

§value: f64
§

IsFloat

Check if value is a float Stores 1 (true) or 0 (false)

Fields

§source: Register
§

IntToFloat

Convert integer to float

Fields

§source: Register
§

FloatToInt

Convert float to integer (truncates toward zero)

Fields

§source: Register
§

Floor

Floor: round down to nearest integer (as float)

Fields

§source: Register
§

Ceil

Ceil: round up to nearest integer (as float)

Fields

§source: Register
§

Round

Round: round to nearest integer (as float)

Fields

§source: Register
§

Trunc

Trunc: truncate toward zero (as float)

Fields

§source: Register
§

Sqrt

Square root

Fields

§source: Register
§

Abs

Absolute value (works for both int and float)

Fields

§source: Register
§

Pow

Power: base^exponent (both operands, result is float)

Fields

§

SendAfter

Send a message to a process after a delay (in reductions) Returns a timer reference in dest for cancellation

Fields

§delay: u32
§

StartTimer

Start a timer that sends {:timeout, ref, msg} to self after delay Returns the timer reference in dest

Fields

§delay: u32
§

CancelTimer

Cancel a pending timer by its reference Returns the remaining time if timer was active, or :ok if already fired

Fields

§timer_ref: Register
§

ReadTimer

Read the remaining time on a timer (0 if already fired or cancelled)

Fields

§timer_ref: Register
§

PrintLn

Print a value to stdout with newline

Fields

§source: Register
§

ReadLine

Read a line from stdin into register as String Returns :eof atom if end of input

Fields

§

FileRead

Read entire file contents as binary Returns {:ok, binary} or {:error, reason}

Fields

§

FileWrite

Write binary/string to file Returns :ok or {:error, reason}

Fields

§content: Register
§

FileExists

Check if file exists Returns 1 (true) or 0 (false)

Fields

§

FileDelete

Delete a file Returns :ok or {:error, reason}

Fields

§

SelfPid

Get own PID into register

Fields

§

ProcessList

Get list of all process PIDs

Fields

§

ProcessCount

Get count of live processes

Fields

§

IsAlive

Check if a process is alive Returns 1 (true) or 0 (false)

Fields

§

ProcessInfo

Get process info as tuple Returns {status, mailbox_len, links_count, monitors_count, trap_exit}

Fields

§

ModuleList

Get list of loaded module names

Fields

§

FunctionExported

Check if function is exported Returns 1 (true) or 0 (false)

Fields

§module: Register
§function: Register
§arity: Register
§

Try

Begin a try block. Pushes exception handler onto try stack. catch_target: where to jump on exception after_target: optional cleanup block (always runs)

Fields

§catch_target: usize
§after_target: Option<usize>
§

EndTry

End a try block successfully. Pops handler from try stack. If there’s an after block, jumps to it.

§

Throw

Throw an exception. Unwinds to nearest catch handler. class: :error, :exit, or :throw reason: the exception reason (from register)

Fields

§class: Register
§reason: Register
§

GetException

Get the current exception as {class, reason, stacktrace} tuple Used in catch blocks to access exception details

Fields

§

ClearException

Clear the current exception (after handling)

§

Reraise

Re-raise the current exception (in catch block)

Trait Implementations§

Source§

impl Clone for Instruction

Source§

fn clone(&self) -> Instruction

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 Instruction

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<D> OwoColorize for D

Source§

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

Set the foreground color generically Read more
Source§

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

Set the background color generically. Read more
Source§

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

Change the foreground color to black
Source§

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

Change the background color to black
Source§

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

Change the foreground color to red
Source§

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

Change the background color to red
Source§

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

Change the foreground color to green
Source§

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

Change the background color to green
Source§

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

Change the foreground color to yellow
Source§

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

Change the background color to yellow
Source§

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

Change the foreground color to blue
Source§

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

Change the background color to blue
Source§

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

Change the foreground color to magenta
Source§

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

Change the background color to magenta
Source§

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

Change the foreground color to purple
Source§

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

Change the background color to purple
Source§

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

Change the foreground color to cyan
Source§

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

Change the background color to cyan
Source§

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

Change the foreground color to white
Source§

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

Change the background color to white
Source§

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

Change the foreground color to the terminal default
Source§

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

Change the background color to the terminal default
Source§

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

Change the foreground color to bright black
Source§

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

Change the background color to bright black
Source§

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

Change the foreground color to bright red
Source§

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

Change the background color to bright red
Source§

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

Change the foreground color to bright green
Source§

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

Change the background color to bright green
Source§

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

Change the foreground color to bright yellow
Source§

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

Change the background color to bright yellow
Source§

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

Change the foreground color to bright blue
Source§

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

Change the background color to bright blue
Source§

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

Change the foreground color to bright magenta
Source§

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

Change the background color to bright magenta
Source§

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

Change the foreground color to bright purple
Source§

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

Change the background color to bright purple
Source§

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

Change the foreground color to bright cyan
Source§

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

Change the background color to bright cyan
Source§

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

Change the foreground color to bright white
Source§

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

Change the background color to bright white
Source§

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

Make the text bold
Source§

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

Make the text dim
Source§

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

Make the text italicized
Source§

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

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

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

Swap the foreground and background colors
Source§

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

Hide the text
Source§

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

Cross out the text
Source§

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

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

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

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

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

Sets the foreground color to an RGB value.
Source§

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

Sets the background color to an RGB value.
Source§

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

Apply a runtime-determined style
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more