Skip to main content

AstArena

Struct AstArena 

Source
pub struct AstArena {
    pub raw: RefCell<HashMap<u32, Rc<RawSelector>>>,
    pub optimized: RefCell<HashMap<u32, SharedOptimizedSelector>>,
    pub first_parts: RefCell<(u64, HashMap<u32, Option<Rc<[u16]>>>)>,
    pub selector_prefixes: RefCell<(u64, HashMap<u32, Rc<[String]>>)>,
    pub sources: RefCell<Vec<u32>>,
    pub input_lengths: RefCell<HashMap<u32, u32>>,
    /* private fields */
}
Expand description

Css ast arena: ast nodes and value tokens. Derefs to Arena (typescript extends).

Fields§

§raw: RefCell<HashMap<u32, Rc<RawSelector>>>

raw selector (minification cache), by rule id split selectors by rule, shared: a read does not copy the selector

§optimized: RefCell<HashMap<u32, SharedOptimizedSelector>>

optimized selector (minification cache), by rule id

§first_parts: RefCell<(u64, HashMap<u32, Option<Rc<[u16]>>>)>

first part of the first selector of a selector string (minification cache), by string id: the string epoch the ids belong to, then the code units (None when the first selector is empty)

§selector_prefixes: RefCell<(u64, HashMap<u32, Rc<[String]>>)>

vendor prefixes of a selector string (minification cache), by string id, see first_parts

§sources: RefCell<Vec<u32>>

source ids. spans store the index in this table (8 bits)

§input_lengths: RefCell<HashMap<u32, u32>>

length of the css parsed into a stylesheet, by stylesheet id

Implementations§

Source§

impl AstArena

Source

pub fn shared(size: usize) -> Rc<Self>

a shared arena: AstArena::rc returns its handle

Source

pub fn register(arena: &Rc<Self>)

register the shared handle of an arena (an arena created by Rc::new)

Source

pub fn rc(&self) -> Rc<AstArena>

the shared handle of the arena

Source

pub fn new(size: usize) -> Self

Source

pub fn base(&self) -> &Arena

the base arena

Source

pub fn release(&self, id: Option<u32>, deep: bool)

Source

pub fn compact(&self, errors: Option<&mut [ErrorDescription]>) -> Vec<u32>

Source

pub fn trim(&self, errors: Option<&mut [ErrorDescription]>) -> Vec<u32>

Source

pub fn get_state(&self, id: u32) -> u32

validation state bits

Source

pub fn set_state(&self, id: u32, state: u32)

set the validation state bits

Source

pub fn is_invalid(&self, id: u32) -> bool

Source

pub fn source_index(&self, src_id: u32) -> u32

index of a source id in the sources table

Source

pub fn set_location( &self, id: u32, src_id: Option<u32>, sta: Option<u32>, end: Option<u32>, )

set the source location. None for both the source and the start drops the location

Source

pub fn set_token_location(&self, id: u32, source_index: u32, sta: u32, end: u32)

set the location of a token from the tokenizer values

Source

pub fn copy_location(&self, id: u32, source: u32)

copy the source location of another node

Source

pub fn span_location(&self, id: u32, start: u32, end: u32)

set the location from the start of a node to the end of another one

Source

pub fn has_location(&self, id: u32) -> bool

Source

pub fn get_location(&self, id: u32) -> Option<SourceLocation>

source location

Source

pub fn get_source(&self, id: u32) -> u32

source id of the node location

Source

pub fn create_style_sheet(&self) -> u32

Source

pub fn create_rule( &self, typ: u8, sel: StrOrId<'_>, tokens: Option<&[u32]>, state: u32, errors: Option<Vec<ErrorDescription>>, ) -> u32

Source

pub fn create_at_rule( &self, typ: u8, nam: StrOrId<'_>, val: StrOrId<'_>, block: bool, tokens: Option<&[u32]>, state: u32, errors: Option<Vec<ErrorDescription>>, ) -> u32

Source

pub fn create_declaration( &self, typ: u8, nam: StrOrId<'_>, val: Option<&[u32]>, state: u32, errors: Option<Vec<ErrorDescription>>, ) -> u32

Source

pub fn create_comment(&self, typ: u8, val: StrOrId<'_>) -> u32

Source

pub fn create_token( &self, typ: u8, val: TokenValue<'_>, unit: Option<&str>, ) -> u32

allocate a token. string values are interned, numeric values are stored in the numeric_value column

Source

pub fn create_str_token(&self, typ: u8, val: &str) -> u32

allocate a token with a string value

Source

pub fn create_num_token(&self, typ: u8, val: f64, unit: Option<&str>) -> u32

allocate a token with a numeric value

Source

pub fn create_color(&self, val: &str, kin: u8, tokens: Option<&[u32]>) -> u32

allocate a color token

Source

pub fn create_function( &self, typ: u8, name: &str, tokens: Option<&[u32]>, ) -> u32

allocate a function token

Source

pub fn create_list(&self, typ: u8, tokens: Option<&[u32]>) -> u32

allocate a list token (parens, attribute, wrapped values, …)

Source

pub fn create_binary_expression(&self, op: u8, l: u32, r: u32) -> u32

allocate a binary expression token. the operator is stored in the numeric_value column

Source

pub fn create_fraction(&self, l: u32, r: u32) -> u32

allocate a fraction token

Source

pub fn has_fraction(&self, id: u32) -> bool

true if the numeric token value is a fraction

Source

pub fn get_fraction(&self, id: u32) -> u32

fraction token of a numeric token

Source

pub fn set_fraction(&self, id: u32, fraction: Option<u32>)

set the fraction value of a numeric token. the numeric value is set to the fraction value

Source

pub fn numerator(&self, id: u32) -> u32

Source

pub fn denominator(&self, id: u32) -> u32

Source

pub fn str(&self, id: u32) -> SharedStr

string value of a token (val)

Source

pub fn set_str(&self, id: u32, value: &str)

set the string value of a token (val)

Source

pub fn set_unit_string(&self, id: u32, unit: Option<&str>)

set the unit of a token

Source

pub fn is_numeric(&self, id: u32) -> bool

true if the token is a numeric token

Source

pub fn replace_token(&self, id: u32, tokens: &[u32])

replace a token by other tokens in its parent token list

Source

pub fn take(&self, token: u32) -> u32

a token that can be attached to a new parent: the token itself when it is detached, a deep clone otherwise

Source

pub fn copy_token(&self, target: u32, source: u32)

copy the data columns of a token

Source

pub fn reset_token( &self, id: u32, typ: u8, val: TokenValue<'_>, unit: Option<&str>, )

reset a token to a new type. the values, the token list and the fields are dropped

Source

pub fn from_object(&self, node: &Plain) -> u32

import a plain object (PlainAstNode / PlainToken). numbers in chi, val, l, … are node ids

Source

pub fn to_plain_object(&self, id: u32) -> Plain

export a node or a token as a plain object (deep copy)

Source

pub fn token_to_object(&self, id: u32) -> Plain

export a token as a plain object (deep copy)

Source

pub fn clone_node(&self, id: u32) -> u32

copy the data of a node (type, strings, values, flags, location, errors)

Source

pub fn clone_node_deep( &self, id: u32, deep: bool, clone_map: Option<&mut HashMap<u32, u32>>, ) -> u32

copy a node or a token (clone(id, deep, cloneMap)). the tokens of a node are copied, its children are copied with deep. the values of a declaration are copied with deep

Source

pub fn clone(&self, id: u32) -> u32

clone(id) with the default arguments

Source

pub fn import(&self, source: &AstArena, id: u32, deep: bool) -> u32

copy a node or a token of another arena into this arena

Source

pub fn index_of(&self, id: u32) -> i32

index of a child in its parent’s children (or tokens) list

Source

pub fn insert_before(&self, reference: u32, nodes: &[u32])

insert nodes before a child

Source

pub fn insert_after(&self, reference: u32, nodes: &[u32])

insert nodes after a child

Source

pub fn prepend_children(&self, id: u32, nodes: &[u32])

prepend children

Source

pub fn replace_child(&self, id: u32, nodes: &[u32])

replace a child with other nodes. the node itself may be part of the replacement

Source

pub fn has_children(&self, id: u32) -> bool

Source

pub fn get_selector(&self, id: u32) -> SharedStr

rule selector

Source

pub fn set_selector(&self, id: u32, sel: &str)

Source

pub fn set_name_string(&self, id: u32, nam: &str)

Source

pub fn set_value_string(&self, id: u32, val: &str)

Source

pub fn expand(&self, ast: u32) -> u32

expand the css nesting rules of a stylesheet, a rule or an at-rule, in place

Source

pub fn replace_compound(&self, input: &str, replace: &str) -> String

replace the nesting selector ‘&’ of a selector

Source

pub fn export_properties(&self) -> ArenaProperties

properties of the arena

Source

pub fn import_properties( &self, properties: &ArenaProperties, transferables: ArenaTransferables, )

initialize the arena from exported properties and column buffers

Source

pub fn expand_rule(&self, node: u32, parent: u32, before: u32)

expand a rule: the nested rules and at-rules are moved out of the rule, into parent before before. the rule is detached when it has no children left

Source

pub fn replace_compound_literal(&self, selector: &str, replace: &str) -> String

(sic) port of replaceCompoundLiteral(): the tokens are "" followed by "&", "" per & of the selector, sorted so that the & come last, then the & are replaced

Methods from Deref<Target = Arena>§

Source

pub fn current(&self) -> u32

last allocated node id

Source

pub fn set_current(&self, current: u32)

Source

pub fn generation(&self) -> u32

incremented when the columns are reallocated

Source

pub fn generation_ptr(&self) -> *const u32

address of the generation counter: the javascript views read it to detect a growth of the columns

Source

pub fn column_raw(&self, index: u32) -> (*const u8, usize)

pointer and length (in elements) of a column, by index of arenaColumns. the column views of javascript

Source

pub fn transferred(&self) -> bool

true when the column buffers have been transferred: the arena can no longer be used

Source

pub fn allocate(&self) -> u32

Source

pub fn recycle(&self, id: u32)

recycle a detached leaf node that is no longer referenced: its id is reused by the next allocation

Source

pub fn intern_string(&self, str: &str) -> u32

intern a string, returns its id

Source

pub fn intern_rc(&self, str: &Rc<str>) -> u32

intern a shared string without copying it

Source

pub fn intern_shared(&self, str: &SharedStr) -> u32

intern a shared string: a shared Rc<str> is not copied

Source

pub fn intern_range( &self, codes: &CodeUnits, start: usize, end: usize, source: i32, ) -> u32

intern a range of code units of a source (or of the canonical text / the pool, see StringSource)

Source

pub fn intern_units(&self, codes: &[u16]) -> u32

intern utf-16 code units

Source

pub fn intern_canonical(&self, start: u32, end: u32) -> u32

intern a range of the canonical text

Source

pub fn set_source_text(&self, source: usize, codes: CodeUnits)

set the code units of a source: the strings interned from the source are ranges of it

Source

pub fn release_source_codes(&self, source: usize)

Source

pub fn source_text(&self, source: usize) -> Option<CodeUnits>

code units of a source

Source

pub fn string_id(&self, str: &str) -> i32

id of an interned string, -1 when the string is not interned

Source

pub fn string_length(&self, id: u32) -> usize

Source

pub fn string_code_at(&self, id: u32, index: usize) -> u32

Source

pub fn string_index_of(&self, id: u32, code: u32) -> isize

Source

pub fn string_equals(&self, id: u32, str: &str) -> bool

Source

pub fn string_equals_ignore_case(&self, id: u32, str: &str) -> bool

Source

pub fn string_starts_with(&self, id: u32, str: &str) -> bool

Source

pub fn lower_string_id(&self, id: u32) -> u32

id of the lowercase version of an interned string

Source

pub fn copy_string_ascii(&self, id: u32, target: &mut Vec<u8>) -> isize

append an interned string to a byte buffer when it is ascii. -1 when it is not ascii

Source

pub fn string_flag( &self, id: u32, flag: StringFlag, compute: impl FnOnce(&str) -> bool, ) -> bool

a boolean property of an interned string, computed once per string id

Source

pub fn string_flag_id( &self, id: u32, flag: StringFlag, compute: impl FnOnce(u32) -> bool, ) -> bool

a boolean property of an interned string, computed once per string id from the id

Source

pub fn string_derived<T: Clone + 'static>( &self, id: u32, slot: StringDerived, compute: impl FnOnce(u32) -> T, ) -> T

a value derived from an interned string, computed once per string id

Source

pub fn copy_string(&self, id: u32, target: &mut Vec<u16>) -> usize

append the code units of an interned string to a buffer

Source

pub fn append_string<'b>( &self, builder: &'b mut StringBuilder, id: u32, ) -> &'b mut StringBuilder

append an interned string to a builder

Source

pub fn intern_builder(&self, builder: &StringBuilder) -> u32

intern the string built by a builder

Source

pub fn string_epoch(&self) -> u64

identity of the string ids: changed when the strings are renumbered

Source

pub fn with_string<R>(&self, id: u32, f: impl FnOnce(&str) -> R) -> R

run a function with an interned string. ascii ranges of a source are borrowed: no string is created

Source

pub fn resolve_string(&self, id: u32) -> SharedStr

the string of an id (created and cached the first time it is read)

Source

pub fn get_type(&self, id: u32) -> u8

Source

pub fn type_of(&self, id: Option<u32>) -> Option<u8>

type of a node or a token. None when the id is None

Source

pub fn set_type(&self, id: u32, typ: u8)

Source

pub fn set_name(&self, id: u32, name_id: u32)

Source

pub fn get_name(&self, id: u32) -> SharedStr

Source

pub fn set_value(&self, id: u32, value_id: u32)

Source

pub fn get_value(&self, id: u32) -> SharedStr

Source

pub fn set_numeric_value(&self, id: u32, value: f64)

Source

pub fn set_unit(&self, id: u32, unit: u32)

Source

pub fn get_unit(&self, id: u32) -> SharedStr

Source

pub fn get_numeric_value(&self, id: u32) -> f64

Source

pub fn set_parent(&self, id: u32, parent: u32)

Source

pub fn get_first_child(&self, id: u32) -> u32

Source

pub fn get_next_sibling(&self, id: u32) -> u32

Source

pub fn get_previous_sibling(&self, id: u32) -> u32

Source

pub fn get_first_token(&self, id: u32) -> u32

Source

pub fn get_last_token(&self, id: u32) -> u32

Source

pub fn get_capacity(&self) -> usize

number of nodes the columns can hold

Source

pub fn get_last_id(&self) -> u32

Source

pub fn memory_size(&self) -> usize

approximate number of bytes held by the arena: the columns (62 bytes per node of the capacity) and the string table

Source

pub fn get_string_count(&self) -> u32

Source

pub fn set_first_child(&self, id: u32, first_child_id: u32)

replace the first child

Source

pub fn get_last_child(&self, id: u32) -> u32

Source

pub fn set_last_child(&self, id: u32, last_child_id: u32)

replace the last child

Source

pub fn set_next_sibling(&self, id: u32, next_sibling_id: u32)

insert a node after another one

Source

pub fn set_previous_sibling(&self, id: u32, previous_sibling_id: u32)

insert a node before another one

Source

pub fn set_first_token(&self, id: u32, first_token_id: u32)

replace the first token

Source

pub fn set_color_type(&self, id: u32, color_type: u8)

Source

pub fn get_color_type(&self, id: u32) -> u8

Source

pub fn set_flags(&self, id: u32, flags: u32)

Source

pub fn get_flags(&self, id: u32) -> u32

Source

pub fn has_flags(&self, id: u32, flag: u32) -> bool

Source

pub fn get_child_at(&self, id: u32, index: u32) -> Option<u32>

child at an index

Source

pub fn get_token_at(&self, id: u32, index: u32) -> Option<u32>

token at an index of the token list

Source

pub fn set_child_at(&self, id: u32, index: u32, child: u32)

replace the child at an index. the node is appended when the index is out of range

Source

pub fn field_list(&self, id: u32, field: u32) -> u32

list node holding the tokens of a structured token field. created when missing

Source

pub fn has_field(&self, id: u32, field: u32) -> bool

true if the field exists and is not empty

Source

pub fn field(&self, id: u32, field: u32) -> u32

first token of a structured token field

Source

pub fn field_tokens(&self, id: u32, field: u32) -> Vec<u32>

tokens of a structured token field

Source

pub fn set_field(&self, id: u32, field: u32, tokens: &[u32])

set the tokens of a structured token field

Source

pub fn append_field(&self, id: u32, field: u32, tokens: &[u32])

append tokens to a structured token field

Source

pub fn set_left(&self, id: u32, children: &[u32])

Source

pub fn get_left(&self, id: u32) -> Option<Vec<u32>>

Source

pub fn set_right(&self, id: u32, right: &[u32])

Source

pub fn get_right(&self, id: u32) -> Option<Vec<u32>>

Source

pub fn set_op(&self, id: u32, op: u32)

Source

pub fn get_op(&self, id: u32) -> u32

Source

pub fn set_op2(&self, id: u32, op2: u32)

Source

pub fn get_op2(&self, id: u32) -> u32

Source

pub fn set_span(&self, id: u32, source_id: u32, start: u32, end: u32)

Source

pub fn copy_span(&self, target: u32, source: u32)

copy the packed location of a node

Source

pub fn get_source_id(&self, id: u32) -> u32

Source

pub fn get_span_start(&self, id: u32) -> u32

Source

pub fn set_span_start(&self, id: u32, start: u32)

(sic: the typescript name is setSpandStart)

Source

pub fn get_span_end(&self, id: u32) -> u32

Source

pub fn set_span_end(&self, id: u32, end: u32)

Source

pub fn get_parent(&self, id: u32) -> u32

Source

pub fn detach(&self, id: u32)

detach a node from its parent

Source

pub fn walk<'f>( &self, node: u32, filter: Option<WalkerFilter<'f>>, reverse: bool, ) -> NodeWalker<'f>

walk the ast nodes: the node and its descendants, in document order

Source

pub fn walk_with<'f>( &self, node: u32, options: WalkerOptions<'f>, ) -> NodeWalker<'f>

walk the ast nodes with options

Source

pub fn walk_values<'f>( &self, node: u32, options: WalkerValueOptions<'f>, reverse: bool, ) -> ValueWalker<'f>

walk the value tokens of a node / token and their descendants

Source

pub fn walk_token_values<'f>( &self, tokens: &[u32], options: WalkerValueOptions<'f>, reverse: bool, ) -> ValueWalker<'f>

walk tokens and their descendants

Source

pub fn walk_ids(&self, node: u32) -> Vec<u32>

node ids of a subtree in document order (collected)

Source

pub fn visit_values(&self, tokens: &[u32], visitor: impl FnMut(&Self, u32))

call the visitor for the tokens and their children, in the order of Arena::walk_values (the children of a token are read after the visitor returns)

Source

pub fn get_value_parent(&self, id: u32) -> u32

parent of a value token: the node / token that owns the token list, or the structured token that owns the field (the field list token is skipped). 0 when the token is detached

Source

pub fn get_value_owner(&self, id: u32) -> u32

node that owns a value token: the declaration, the rule or the at-rule. 0 when the token is detached

Source

pub fn find( &self, node: u32, matcher: impl FnMut(&Self, u32) -> bool, ) -> Option<u32>

first match of a subtree, in document order

Source

pub fn find_all( &self, node: u32, matcher: impl FnMut(&Self, u32) -> bool, ) -> Vec<u32>

all the matches of a subtree, in document order

Source

pub fn find_last( &self, node: u32, matcher: impl FnMut(&Self, u32) -> bool, ) -> Option<u32>

last match of a subtree in document order

Source

pub fn find_by_value( &self, node: u32, matcher: impl FnMut(&Self, u32) -> bool, ) -> Option<(u32, u32)>

first value token match of a subtree: the node that owns the token and the token

Source

pub fn find_value( &self, node: u32, matcher: impl FnMut(&Self, u32) -> bool, ) -> Option<u32>

first match of a token and its descendants, or of the value tokens of a node

Source

pub fn sub_tokens(&self, id: u32) -> Vec<u32>

direct value tokens of a node or a token: the token list, then the tokens of the structured fields and the child tokens

Source

pub fn find_child( &self, id: u32, predicate: impl FnMut(u32) -> bool, ) -> Option<u32>

Source

pub fn find_token( &self, id: u32, predicate: impl FnMut(&Self, u32) -> bool, ) -> Option<u32>

find a token in the token list

Source

pub fn siblings( &self, id: u32, filter: Option<&mut dyn FnMut(&Self, u32) -> bool>, ) -> Vec<u32>

the children of the parent of a node, the node included

Source

pub fn children(&self, id: u32) -> Vec<u32>

child node ids

Source

pub fn children_filtered( &self, id: u32, filter: impl FnMut(&Self, u32) -> bool, ) -> Vec<u32>

child node ids accepted by a filter

Source

pub fn tokens(&self, id: u32) -> Vec<u32>

token ids of the token list

Source

pub fn tokens_filtered( &self, id: u32, filter: impl FnMut(&Self, u32) -> bool, ) -> Vec<u32>

token ids of the token list accepted by a filter

Source

pub fn token_iter(&self, id: u32) -> impl Iterator<Item = u32> + '_

iterate the token list without allocation. the next token is read before the current one is returned

Source

pub fn child_iter(&self, id: u32) -> impl Iterator<Item = u32> + '_

iterate the children without allocation. the next child is read before the current one is returned

Source

pub fn token_count(&self, id: u32) -> u32

number of tokens in the token list

Source

pub fn set_children(&self, id: u32, children: &[u32])

Source

pub fn set_child_list(&self, id: u32, children: &[u32])

replace the children

Source

pub fn set_tokens(&self, id: u32, tokens: &[u32])

Source

pub fn set_token_list(&self, id: u32, tokens: &[u32])

replace the token list

Source

pub fn move_children(&self, from: u32, to: u32, before: u32)

move the children of a node into another node, in order

Source

pub fn append_children(&self, id: u32, children: &[u32])

Source

pub fn append_child_list(&self, id: u32, children: &[u32])

append children

Source

pub fn append_tokens(&self, id: u32, tokens: &[u32])

Source

pub fn append_token_list(&self, id: u32, tokens: &[u32])

append tokens

Source

pub fn append_child(&self, id: u32, child: u32)

append a single child node

Source

pub fn append_token(&self, id: u32, token: u32)

append a single token

Source

pub fn prepend_tokens(&self, id: u32, tokens: &[u32])

prepend tokens to the token list

Source

pub fn equals_ignore_case(&self, node: u32, key: &str, string: &str) -> bool

key is “nam” or “val”

Source

pub fn starts_with(&self, node: u32, key: &str, string: &str) -> bool

key is “nam” or “val”

Source

pub fn resize(&self, new_size: usize)

grow the columns

Source

pub fn compact_strings(&self)

drop the interned strings that are no longer referenced by any node

Source

pub fn compact(&self, errors: Option<&mut [ErrorDescription]>) -> Vec<u32>

drop the nodes that are not reachable from the root and renumber the remaining nodes in document order. the unused strings are dropped too. returns the mapping of the old ids to the new ids (0 when dropped)

Source

pub fn import_columns(&self, t: ArenaTransferables)

replace the columns

Source

pub fn mark(&self, ids: &[u32])

mark nodes to be released or trimmed later

Source

pub fn is_marked(&self, id: u32) -> bool

Source

pub fn release(&self, id: Option<u32>, deep: bool)

release nodes: detach them and drop their data. None releases the marked nodes

Source

pub fn trim(&self, errors: Option<&mut [ErrorDescription]>) -> Vec<u32>

reclaim the memory: release the marked nodes, then compact

Source

pub fn set_errors(&self, id: u32, errors: Option<Vec<ErrorDescription>>)

Source

pub fn get_errors(&self, id: u32) -> Option<Vec<ErrorDescription>>

Source

pub fn child_count(&self, id: u32) -> u32

number of children

Source

pub fn export_properties(&self) -> ArenaProperties

properties of the arena

Source

pub fn export_transferables(&self) -> ArenaTransferables

copy of the columns

Source

pub fn take_transferables(&self) -> ArenaTransferables

move the columns out (transfer): the arena can no longer be used

Source

pub fn import_properties( &self, properties: &ArenaProperties, transferables: ArenaTransferables, )

initialize the arena from exported properties and column buffers

Trait Implementations§

Source§

impl Default for AstArena

Source§

fn default() -> Self

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

impl Deref for AstArena

Source§

type Target = Arena

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Arena

Dereferences the value.

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, 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.