Skip to main content

ModuleBuilder

Struct ModuleBuilder 

Source
#[non_exhaustive]
pub struct ModuleBuilder { /* private fields */ }
Expand description

In-progress core-Wasm module.

Carries the runtime memory plus every wasm section the backend assembles; the heap-pointer global and the data section are emitted at Self::finish time so the initial heap-pointer value can be relocated past whatever string-literal data has been seeded in the meantime.

Implementations§

Source§

impl ModuleBuilder

Source

pub fn new() -> Self

Build an empty validating module with the runtime memory in place. The heap-pointer global is materialized at Self::finish time so its initial value can reflect any static data segments accumulated meanwhile.

Source

pub fn set_function_name(&mut self, function_index: u32, name: &str)

Record a source-level name for the wasm function at function_index. Names land in the name custom section emitted at Self::finish time and let debug tooling (wasmtime --debug, browser devtools, wasm-tools print) show readable identifiers instead of func[N]. Calling for an index past the current end-of-vector grows the names vector; any unwritten slot stays anonymous.

Source

pub fn set_static_data(&mut self, bytes: Vec<u8>)

Install bytes as the contents of the static data segment.

The segment is emitted as an active data segment at offset 0 of linear memory at Self::finish time; the heap-pointer global’s initial value is bumped past the end of the segment (rounded up to BUMP_ALLOCATOR_ALIGN) so subsequent bump- allocator calls cannot trample the data. Calling repeatedly replaces the previously-installed contents.

Module-lowering builds this buffer by concatenating the string pool’s bytes (at offset 0) with any per-impl vtable blobs. Both regions are read-only static data — strings keep header/byte offsets within the buffer; vtables store funcref-table indices that virtual-dispatch lowering loads at the call site.

Source

pub fn declare_type(&mut self, params: &[ValType], results: &[ValType]) -> u32

Declare a wasm function-type signature without attaching a function body. Used by call_indirect lowerings that need a type-index for the call’s signature; the index is stable across the rest of the build.

Source

pub fn declare_closure_table(&mut self, num_closures: u32) -> u32

Lazy-create the funcref Table of num_closures slots used by indirect closure invocation. Returns the table index. Calling repeatedly returns the original index without re-declaring.

Source

pub fn populate_closure_table(&mut self, wasm_func_indices: &[u32])

Populate the closure funcref table with wasm_func_indices, in order, starting at element offset 0. The closure value’s stored funcref index is the slot number (the table’s element index), which call_indirect resolves to the function pointer at runtime.

Source

pub const fn closure_table_index(&self) -> Option<u32>

Wasm table index of the closure funcref table if declared.

Source

pub fn declare_method_table(&mut self, num_methods: u32) -> u32

Lazy-create the funcref Table of num_methods slots used by virtual trait-method dispatch. Returns the table index. Calling repeatedly returns the original index without re-declaring.

Source

pub fn populate_method_table(&mut self, wasm_func_indices: &[u32])

Populate the method funcref table with wasm_func_indices, in order, starting at element offset 0. The vtable slot value stored in linear memory is the slot number (the table’s element index), which call_indirect resolves to the function pointer at runtime.

Source

pub const fn method_table_index(&self) -> Option<u32>

Wasm table index of the method funcref table if declared.

Source

pub fn export_function(&mut self, name: &str, function_index: u32)

Export a previously-declared function under name.

Source

pub fn declare_function_with_body( &mut self, param_types: &[ValType], result_types: &[ValType], body: &Function, ) -> u32

Declare a function with the given param + result valtypes and a caller-supplied body. The body must already include the closing end instruction. Returns the wasm function index — accounting for the imported-function region that occupies the leading indices of the wasm function-index space.

Source

pub fn declare_function_import( &mut self, module_name: &str, fn_name: &str, param_types: &[ValType], result_types: &[ValType], ) -> u32

Declare a wasm function import under (module_name, fn_name) with the given signature, and return the wasm function index assigned to it.

Imports occupy the leading region of the wasm function-index space — the spec orders the import section before the function section. Every call to this method must therefore happen before any Self::declare_function_with_body call whose returned index the caller intends to compare against an import’s; the helper itself bumps import_function_count so subsequent locally-defined functions land at the right offset.

Source

pub fn declare_function( &mut self, param_types: &[ValType], result_types: &[ValType], ) -> u32

Declare a function with the given param + result valtypes and a placeholder unreachable body. Useful for tests and for laying down the function-index space before bodies are lowered.

Source

pub fn declare_bump_allocator(&mut self) -> u32

Declare and emit the bump-allocator runtime helper, returning its wasm function index. Subsequent calls return the same index without re-emitting the function — the helper is meant to live exactly once per module.

Signature: __alloc(size: i32) -> i32 (raw byte size in, allocation address out). Each returned address is aligned up to BUMP_ALLOCATOR_ALIGN bytes; the heap pointer global is advanced past the allocation. Out-of-memory is not yet handled — callers that bust the linear-memory ceiling get a wasm trap.

Source

pub const fn bump_allocator_index(&self) -> Option<u32>

Wasm function index of the bump allocator if it has been declared, else None.

Source

pub fn declare_str_eq(&mut self) -> u32

Declare and emit the __str_eq runtime helper, returning its wasm function index. Subsequent calls return the same index.

Signature: __str_eq(a: i32, b: i32) -> i32. Each input is a pointer to an { ptr, len } string header. Returns 1 when the two strings have identical byte sequences, 0 otherwise.

Implementation: load both len slots; if they differ, return 0. Otherwise loop over the bytes pointed at by each ptr, comparing one byte at a time. Returns 1 once the loop runs to completion without finding a mismatch.

Source

pub const fn str_eq_index(&self) -> Option<u32>

Wasm function index of the __str_eq helper if it has been declared, else None.

Source

pub fn declare_str_concat(&mut self) -> u32

Declare and emit the __str_concat runtime helper, returning its wasm function index. Subsequent calls return the same index. The bump allocator must already be declared (we re-declare it lazily here if needed since the helper calls it twice).

Signature: __str_concat(a: i32, b: i32) -> i32. Each input is a string-header pointer; the result is a freshly-allocated header pointing at a freshly-allocated byte buffer that contains the concatenation of a’s bytes followed by b’s bytes.

Implementation: allocate a.len + b.len bytes for the buffer, memory.copy each input into place, allocate an 8-byte header, store (buffer_ptr, total_len), and return the header pointer.

Source

pub const fn str_concat_index(&self) -> Option<u32>

Wasm function index of the __str_concat helper if declared.

Source

pub fn declare_str_len(&mut self) -> u32

Declare and emit the __str_len runtime helper, returning its wasm function index. Subsequent calls return the same index.

Signature: __str_len(s: i32) -> i32. Reads the len slot from the input’s { ptr, len } string header.

Source

pub const fn str_len_index(&self) -> Option<u32>

Wasm function index of the __str_len helper if declared.

Source

pub fn declare_str_is_empty(&mut self) -> u32

Declare and emit the __str_is_empty runtime helper, returning its wasm function index. Subsequent calls return the same index.

Signature: __str_is_empty(s: i32) -> i32. Loads the len slot from the input’s { ptr, len } header and returns 1 when len == 0, else 0. Backs the prelude’s extern impl String { fn is_empty(self) -> Boolean }.

Source

pub const fn str_is_empty_index(&self) -> Option<u32>

Wasm function index of the __str_is_empty helper if declared.

Source

pub fn declare_str_byte_at(&mut self) -> u32

Declare and emit the __str_byte_at runtime helper, returning its wasm function index. Subsequent calls return the same index.

Signature: __str_byte_at(s: i32, i: i32) -> i32. Traps via unreachable when i is out of [0, len) (the unsigned comparison covers negative i too — reinterpreted, it’s a huge u32 well past any sensible string length). Otherwise returns the byte at s.ptr + i zero-extended into i32. Backs String::byte_at and the s[i] desugaring.

Source

pub const fn str_byte_at_index(&self) -> Option<u32>

Wasm function index of the __str_byte_at helper if declared.

Source

pub fn declare_str_slice(&mut self) -> u32

Declare and emit the __str_slice runtime helper, returning its wasm function index. Subsequent calls return the same index. The bump allocator is declared lazily for the header allocation.

Signature: __str_slice(s: i32, start: i32, end: i32) -> i32. Returns a freshly-allocated { ptr, len } header whose ptr points into the source string’s existing backing buffer at offset start, with len = end - start. Traps via unreachable when start > end (unsigned, which also catches negative start reinterpreted as a huge u32) or when end > s.len.

Strings are immutable end-to-end so sharing the buffer is sound. Backs String::slice.

Source

pub const fn str_slice_index(&self) -> Option<u32>

Wasm function index of the __str_slice helper if declared.

Source

pub fn declare_str_starts_with(&mut self) -> u32

Declare and emit the __str_starts_with runtime helper, returning its wasm function index. Subsequent calls return the same index.

Signature: __str_starts_with(s: i32, prefix: i32) -> i32. Returns 1 when s begins with prefix, 0 otherwise. Empty prefix is always a match (loop body runs zero times). Implementation: short-circuits when prefix.len > s.len, then runs a byte-equality loop bounded by prefix.len. Backs String::starts_with.

Source

pub const fn str_starts_with_index(&self) -> Option<u32>

Wasm function index of the __str_starts_with helper if declared.

Source

pub fn declare_str_contains(&mut self) -> u32

Declare and emit the __str_contains runtime helper, returning its wasm function index. Subsequent calls return the same index.

Signature: __str_contains(s: i32, needle: i32) -> i32. Naive O(n·m) substring search. Returns 1 when needle appears in s at any offset, else 0. Empty needle is always a match (early return). Needle longer than source short-circuits to 0. Backs String::contains.

Source

pub const fn str_contains_index(&self) -> Option<u32>

Wasm function index of the __str_contains helper if declared.

Source

pub fn declare_array_len(&mut self) -> u32

Declare and emit the __array_len runtime helper. Reads the len field of the { ptr, len, cap } array header. Signature: __array_len(arr: i32) -> i32.

Source

pub fn declare_array_is_empty(&mut self) -> u32

Declare and emit the __array_is_empty helper. Returns 1 when the array’s len is 0, else 0.

Source

pub fn declare_optional_is_some(&mut self) -> u32

Declare and emit the __optional_is_some helper. Loads the 4-byte tag at offset 0; the prelude reserves crate::layout::OPTIONAL_TAG_NIL (0) for the nil/none arm so any non-zero tag indicates Some(_).

Source

pub fn declare_optional_is_none(&mut self) -> u32

Declare and emit the __optional_is_none helper. Returns 1 when the tag at offset 0 is OPTIONAL_TAG_NIL (0).

Source

pub fn declare_range_len(&mut self) -> u32

Declare and emit the __range_len helper for Range<I32>. Computes end - start from the two i32 fields of a Range header. Range over wider types lands in a follow-up.

Source

pub fn declare_range_is_empty(&mut self) -> u32

Declare and emit the __range_is_empty helper for Range<I32>. Returns 1 when end <= start.

Source

pub fn declare_dict_len(&mut self) -> u32

Declare and emit the __dict_len helper. Mirrors __array_len since the Dictionary header reuses the array { ptr, len, cap } shape.

Source

pub fn declare_dict_is_empty(&mut self) -> u32

Declare and emit the __dict_is_empty helper.

Source

pub fn declare_cabi_realloc(&mut self) -> u32

Declare and export cabi_realloc, the canonical-ABI hook the component runtime calls to allocate buffers in our linear memory before passing string / list<T> arguments in. The bump allocator is declared lazily if needed.

Signature: cabi_realloc(orig_ptr: i32, orig_size: i32, align: i32, new_size: i32) -> i32. Our bump allocator can’t actually resize an existing region, so we always hand back a fresh __alloc(new_size) allocation — the orig_* / align inputs are ignored. That’s correct for the canonical-ABI cases we hit today (fresh allocations during string / list lowering): the host writes the bytes into the freshly-allocated region and then hands us the (ptr, len) pair.

Source

pub fn function_count(&self) -> u32

Total wasm function-index-space size — imports plus locally- defined functions. The wasm spec puts imports first, so this is import_function_count + functions.len().

Source

pub fn finish(self) -> Vec<u8>

Encode the module as a sequence of bytes ready for validation or component wrapping.

Trait Implementations§

Source§

impl Debug for ModuleBuilder

Source§

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

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

impl Default for ModuleBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

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, 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