Block

Struct Block 

Source
pub struct Block { /* private fields */ }
Expand description

Represents a basic block in the IR.

Basic blocks are used in SSA regions to provide the structure of the control-flow graph. Operations within a basic block appear in the order they will be executed.

A block must have a traits::Terminator, an operation which transfers control to another block in the same region, or out of the containing operation (e.g. returning from a function).

Blocks have predecessors and successors, representing the inbound and outbound edges (respectively) formed by operations that transfer control between blocks. A block can have zero or more predecessors and/or successors. A well-formed region will generally only have a single block (the entry block) with no predecessors (i.e. no unreachable blocks), and no blocks with both multiple predecessors and multiple successors (i.e. no critical edges). It is valid to have both unreachable blocks and critical edges in the IR, but they must be removed during the course of compilation.

Implementations§

Source§

impl Block

Source

pub fn print(&self, flags: &OpPrintingFlags) -> Document

Source§

impl Block

Source

pub fn new(id: BlockId) -> Self

Source

pub fn as_block_ref(&self) -> BlockRef

Source

pub fn parent(&self) -> Option<RegionRef>

Get a handle to the containing Region of this block, if it is attached to one

Source

pub fn parent_op(&self) -> Option<OperationRef>

Get a handle to the containing Operation of this block, if it is attached to one

Source

pub fn parent_block(&self) -> Option<BlockRef>

Get a handle to the ancestor Block of this block, if one is present

Source

pub fn is_entry_block(&self) -> bool

Returns true if this block is the entry block for its containing region

Source

pub fn front(&self) -> Option<OperationRef>

Get the first operation in the body of this block

Source

pub fn back(&self) -> Option<OperationRef>

Get the last operation in the body of this block

Source

pub fn body(&self) -> &OpList

Get the list of Operation comprising the body of this block

Source

pub fn body_mut(&mut self) -> &mut OpList

Get a mutable reference to the list of Operation comprising the body of this block

Source§

impl Block

Arguments

Source

pub fn has_arguments(&self) -> bool

Source

pub fn num_arguments(&self) -> usize

Source

pub fn arguments(&self) -> &[BlockArgumentRef]

Source

pub fn arguments_mut(&mut self) -> &mut Vec<BlockArgumentRef>

Source

pub fn argument_values(&self) -> impl ExactSizeIterator<Item = ValueRef> + '_

Source

pub fn argument_types(&self) -> impl ExactSizeIterator<Item = Type> + '_

Source

pub fn get_argument(&self, index: usize) -> BlockArgumentRef

Source

pub fn erase_argument(&mut self, index: usize)

Erase the block argument at index

Panics if the argument still has uses.

Source

pub fn erase_arguments<F>(&mut self, should_erase: F)
where F: Fn(&BlockArgument) -> bool,

Erase every parameter of this block for which should_erase returns true.

Panics if any argument to be erased still has uses.

Source

pub fn erase(&mut self)

Source§

impl Block

Placement

Source

pub fn insert_after(&mut self, after: BlockRef)

Insert this block after after in its containing region.

Panics if this block is already attached to a region, or if after is not attached.

Source

pub fn insert_before(&mut self, before: BlockRef)

Insert this block before before in its containing region.

Panics if this block is already attached to a region, or if before is not attached.

Source

pub fn insert_at_end(&mut self, region: RegionRef)

Insert this block at the end of region.

Panics if this block is already attached to a region.

Source

pub fn move_before(&mut self, before: BlockRef)

Unlink this block from its current region and insert it right before before

Source

pub fn splice_block(&mut self, block: &mut Self)

Splice the body of block to the end of self, updating the parent of all spliced ops.

It is up to the caller to ensure that this operation produces valid IR.

Source

pub fn splice_block_before(&mut self, block: &mut Self, ip: OperationRef)

Splice the body of block to self before ip, updating the parent of all spliced ops.

It is up to the caller to ensure that this operation produces valid IR.

Source

pub fn splice_block_after(&mut self, block: &mut Self, ip: OperationRef)

Splice the body of block to self after ip, updating the parent of all spliced ops.

It is up to the caller to ensure that this operation produces valid IR.

Source

pub fn split_block(&mut self, before: OperationRef) -> BlockRef

Split this block into two blocks before the specified operation

Note that all operations in the block prior to before stay as part of the original block, and the rest are moved to the new block, including the old terminator. The original block is thus left without a terminator.

Returns the newly created block.

Source

pub fn clear(&mut self)

Source§

impl Block

Ancestors

Source

pub fn has_ssa_dominance(&self) -> bool

Source

pub fn traverse_ancestors<F>(block: BlockRef, f: F) -> Option<BlockRef>
where F: FnMut(BlockRef) -> bool,

Walk up the ancestor blocks of block, until f returns true for a block.

NOTE: block is visited before any of its ancestors.

Source

pub fn get_blocks_in_same_region( a: BlockRef, b: BlockRef, ) -> Option<(BlockRef, BlockRef)>

Try to get a pair of blocks, starting with the given pair, which live in the same region, by exploring the relationships of both blocks with respect to their regions.

The returned block pair will either be the same input blocks, or some combination of those blocks or their ancestors.

Source§

impl Block

Predecessors and Successors

Source

pub fn has_predecessors(&self) -> bool

Returns true if this block has predecessors

Source

pub fn predecessors(&self) -> EntityIter<'_, BlockOperand>

Get an iterator over the predecessors of this block

Source

pub fn get_single_predecessor(&self) -> Option<BlockRef>

If this block has exactly one predecessor, return it, otherwise None

NOTE: A predecessor block with multiple edges, e.g. a conditional branch that has this block as the destination for both true/false branches is not considered a single predecessor by this function.

Source

pub fn get_unique_predecessor(&self) -> Option<BlockRef>

If this block has a unique predecessor, i.e. all incoming edges originate from one block, return it, otherwise None

Source

pub fn has_successors(&self) -> bool

Returns true if this block has any successors

Source

pub fn num_successors(&self) -> usize

Get the number of successors of this block in the CFG

Source

pub fn get_successor(&self, index: usize) -> BlockRef

Get the indexth successor of this block’s terminator operation

Source

pub fn drop_all_references(&mut self)

This drops all operand uses from operations within this block, which is an essential step in breaking cyclic dependences between references when they are to be deleted.

Source

pub fn drop_all_defined_value_uses(&mut self)

This drops all uses of values defined in this block or in the blocks of nested regions wherever the uses are located.

Source

pub fn drop_all_uses(&mut self)

Drop all uses of this block via BlockOperand

Source

pub fn replace_all_uses_with(&mut self, replacement: BlockRef)

Source

pub fn terminator(&self) -> Option<OperationRef>

Get the terminator operation of this block, or None if the block does not have one.

Source

pub fn has_terminator(&self) -> bool

Returns true if this block has a terminator

Trait Implementations§

Source§

impl Debug for Block

Source§

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

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

impl Display for Block

Source§

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

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

impl Dominates for Block

The dominance relationship between two blocks.

Source§

fn dominates(&self, other: &Self, dom_info: &DominanceInfo) -> bool

Returns true if a == b or a properly dominates b.

Source§

fn properly_dominates(&self, other: &Self, dom_info: &DominanceInfo) -> bool

Returns true if a != b and:

  • a is an ancestor of b
  • The region containing a also contains b or some ancestor of b, and a dominates that block in that kind of region.
  • In SSA regions, a properly dominates b if all control flow paths from the entry block to b, flow through a.
  • In graph regions, all blocks dominate all other blocks.
Source§

impl EntityListItem for Block

Source§

fn on_inserted( this: UnsafeIntrusiveEntityRef<Self>, cursor: &mut EntityCursorMut<'_, Self>, )

Invoked when this entity type is inserted into an intrusive list
Source§

fn on_removed( this: UnsafeIntrusiveEntityRef<Self>, list: &mut EntityCursorMut<'_, Self>, )

Invoked when this entity type is removed from an intrusive list
Source§

fn on_transfer( this: UnsafeIntrusiveEntityRef<Self>, from: &mut EntityList<Self>, to: &mut EntityList<Self>, )

Invoked when a set of entities is moved from one intrusive list to another
Source§

impl EntityParent<Block> for Region

Source§

fn offset() -> usize

Statically compute the offset of the EntityList within Self that is used to store children of type Child.
Source§

impl EntityParent<BlockOperand> for Block

Source§

fn offset() -> usize

Statically compute the offset of the EntityList within Self that is used to store children of type Child.
Source§

impl EntityParent<Operation> for Block

Source§

fn offset() -> usize

Statically compute the offset of the EntityList within Self that is used to store children of type Child.
Source§

impl EntityWithId for Block

Source§

type Id = BlockId

Source§

fn id(&self) -> Self::Id

Source§

impl EntityWithParent for Block

Source§

type Parent = Region

The parent entity that this entity logically belongs to.
Source§

impl From<&Block> for ProgramPoint

Construct a ProgramPoint referring to the point at entry to block

Source§

fn from(block: &Block) -> Self

Converts to this type from the input type.
Source§

impl Graph for Block

Source§

type ChildEdgeIter = BlockSuccessorEdgesIter

Type used to iterate over child edges of a node in the graph.
Source§

type ChildIter = BlockSuccessorIter

Type used to iterate over children of a node in the graph.
Source§

type Edge = RawEntityRef<BlockOperand, IntrusiveLink>

The type used to represent an edge in the graph. Read more
Source§

type Node = RawEntityRef<Block, IntrusiveLink>

The type of node represented in the graph. Read more
Source§

fn size(&self) -> usize

Get the number of nodes in this graph
Source§

fn entry_node(&self) -> Self::Node

Get the entry node of the graph. Read more
Source§

fn children(parent: Self::Node) -> Self::ChildIter

Get an iterator over the children of parent
Source§

fn children_edges(parent: Self::Node) -> Self::ChildEdgeIter

Get an iterator over the children edges of parent
Source§

fn edge_dest(edge: Self::Edge) -> Self::Node

Return the destination node of an edge.
Source§

fn is_empty(&self) -> bool

An empty graph has no nodes.
Source§

impl Hash for Block

Source§

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

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

impl<'a> InvertibleGraph for &'a Block

Source§

type Inverse = Inverse<&'a Block>

The type of this graph’s inversion Read more
Source§

type InvertibleChildEdgeIter = BlockPredecessorEdgesIter

The type of iterator used to obtain the set of “inverted” children edges of a node in this graph, i.e. the predecessor edges.
Source§

type InvertibleChildIter = BlockPredecessorIter

The type of iterator used to visit “inverted” children of a node in this graph, i.e. the predecessors.
Source§

fn inverse(self) -> Self::Inverse

Obtain the inversion of this graph
Source§

fn inverse_children(parent: Self::Node) -> Self::InvertibleChildIter

Get an iterator over the predecessors of parent. Read more
Source§

fn inverse_children_edges(parent: Self::Node) -> Self::InvertibleChildEdgeIter

Get an iterator over the predecessor edges of parent.
Source§

impl PartialEq for Block

Source§

fn eq(&self, other: &Self) -> 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 PostDominates for Block

The post-dominance relationship between two blocks.

Source§

fn properly_post_dominates( &self, other: &Self, dom_info: &PostDominanceInfo, ) -> bool

Returns true if a != b and:

  • a is an ancestor of b
  • The region containing a also contains b or some ancestor of b, and a dominates that block in that kind of region.
  • In SSA regions, a properly post-dominates b if all control flow paths from b to an exit node, flow through a.
  • In graph regions, all blocks post-dominate all other blocks.
Source§

fn post_dominates(&self, other: &Self, dom_info: &PostDominanceInfo) -> bool

Returns true if self post-dominates other. Read more
Source§

impl PrettyPrint for Block

Source§

fn render(&self) -> Document

The core of the PrettyPrint functionality. Read more
Source§

fn to_pretty_string(&self) -> String

Produce a String containing the results of pretty-printing this object. Read more
Source§

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

Pretty-print this object to the given core::fmt::Formatter. Read more
Source§

impl Spanned for Block

Source§

impl Usable for Block

Source§

type Use = BlockOperand

The type associated with each unique use, e.g. OpOperand
Source§

fn uses(&self) -> &EntityList<BlockOperand>

Get a list of uses of this definition
Source§

fn uses_mut(&mut self) -> &mut EntityList<BlockOperand>

Get a mutable list of uses of this definition
Source§

fn is_used(&self) -> bool

Returns true if this definition is used
Source§

fn iter_uses(&self) -> EntityIter<'_, Self::Use>

Get an iterator over the uses of this definition
Source§

fn first_use(&self) -> EntityCursor<'_, Self::Use>

Get a cursor positioned on the first use of this definition, or the null cursor if unused.
Source§

fn first_use_mut(&mut self) -> EntityCursorMut<'_, Self::Use>

Get a mutable cursor positioned on the first use of this definition, or the null cursor if unused.
Source§

fn insert_use(&mut self, user: UnsafeIntrusiveEntityRef<Self::Use>)

Add user to the set of uses of this definition
Source§

impl Entity for Block

Source§

impl Eq for Block

Auto Trait Implementations§

§

impl !Freeze for Block

§

impl !RefUnwindSafe for Block

§

impl !Send for Block

§

impl !Sync for Block

§

impl Unpin for Block

§

impl !UnwindSafe for Block

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

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<H> DynHash for H
where H: Hash,

Source§

fn dyn_hash(&self, hasher: &mut dyn Hasher)

Source§

impl<T> DynPartialEq for T
where T: PartialEq + 'static,

Source§

default fn dyn_eq(&self, rhs: &(dyn DynPartialEq + 'static)) -> bool

Source§

impl<T> EntityListItem for T
where T: Entity,

Source§

default fn on_inserted( _this: RawEntityRef<T, IntrusiveLink>, _list: &mut EntityCursorMut<'_, T>, )

Invoked when this entity type is inserted into an intrusive list
Source§

default fn on_removed( _this: RawEntityRef<T, IntrusiveLink>, _list: &mut EntityCursorMut<'_, T>, )

Invoked when this entity type is removed from an intrusive list
Source§

default fn on_transfer( _this: RawEntityRef<T, IntrusiveLink>, _from: &mut EntityList<T>, _to: &mut EntityList<T>, )

Invoked when a set of entities is moved from one intrusive list to another
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. 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> PassTarget for T
where T: 'static,

Source§

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

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. 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, Trait> Verifier<Trait> for T
where Trait: ?Sized,

Source§

const VACUOUS: bool = true

An implementation of Verifier sets this flag to true when its implementation is vacuous, i.e. it always succeeds and is not dependent on runtime context. Read more
Source§

default fn should_verify(&self, _context: &Context) -> bool

Checks if this verifier is applicable for the current item
Source§

default fn maybe_verify(&self, _context: &Context) -> Result<(), Report>

Applies the verifier for this item, if Verifier::should_verify returns true
Source§

default fn verify(&self, _context: &Context) -> Result<(), Report>

Applies the verifier for this item
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