Skip to main content

VarMap

Enum VarMap 

Source
pub enum VarMap<V> {
    Small(Vec<(Rc<str>, V)>),
    Big(Box<BigVarMap<V>>),
}

Variants§

§

Small(Vec<(Rc<str>, V)>)

§

Big(Box<BigVarMap<V>>)

Implementations§

Source§

impl<V> VarMap<V>

Source

pub fn with_capacity(n: usize) -> Self

Source

fn entries(&self) -> &[(Rc<str>, V)]

Source

fn entries_vec_mut(&mut self) -> &mut Vec<(Rc<str>, V)>

Source

fn position(&self, k: &str) -> Option<usize>

Source

pub fn get(&self, k: &str) -> Option<&V>

Source

pub fn entry_at(&self, i: usize) -> Option<(&Rc<str>, &V)>

i 番目の名前と値。

Source

pub fn position_of(&self, k: &str) -> Option<usize>

名前の位置。

Source

pub fn entry_at_mut(&mut self, i: usize, key: *const u8) -> Option<&mut V>

i 番目の名前の番地が key なら値を返す。

Source

pub fn get_mut(&mut self, k: &str) -> Option<&mut V>

Source

pub fn contains_key(&self, k: &str) -> bool

Source

pub fn insert(&mut self, k: Rc<str>, v: V) -> Option<V>

値を入れる(既にあれば値だけ置き換え、前の値を返す。順序は保つ)。

Source

pub fn shift_remove(&mut self, k: &str) -> Option<V>

取り除く(後ろの順序は詰める)。

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> impl Iterator<Item = (&Rc<str>, &V)>

Source

pub fn keys(&self) -> impl Iterator<Item = &Rc<str>>

Source

pub fn values(&self) -> impl Iterator<Item = &V>

Source

pub fn into_values(self) -> impl Iterator<Item = V>

Source

pub fn clear_keep_capacity(&mut self)

確保済みの entries 容量を残したまま空にする(スコープ再利用プール用)。

Source

pub fn shrink_to_fit(&mut self)

余分な確保容量を切り詰める(クロージャに捕捉されて長寿命化するスコープ用)。

Source

pub fn ensure_capacity(&mut self, n: usize)

少なくとも n 要素分の容量を確保する。

Source

pub fn capacity(&self) -> usize

Source

pub fn push_fresh_small(&mut self, k: Rc<str>, v: V)

空または重複のない Small 状態に、キー比較なしでエントリを末尾追加する。 VAR_INDEX_MIN を超えた場合は呼び出し完了後に promote_if_big を呼ぶこと。

Source

pub fn push_hoisted_missing( &mut self, k: &Rc<str>, n_prefix: usize, default_val: V, )

巻き上げ変数リストのうち先頭 n_prefix 件(一意な仮引数)に含まれないものだけを末尾追加する。 hoisted 自体が重複なしであるため、追加済みの巻き上げ変数同士の比較を省略できる。

Source

pub fn promote_if_big(&mut self)

push_fresh_small / push_hoisted_missing による一括追加後、閾値超なら Big へ昇格させる。

Trait Implementations§

Source§

impl<V: Clone> Clone for VarMap<V>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<V> Default for VarMap<V>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<V> !Send for VarMap<V>

§

impl<V> !Sync for VarMap<V>

§

impl<V> Freeze for VarMap<V>

§

impl<V> RefUnwindSafe for VarMap<V>
where V: RefUnwindSafe,

§

impl<V> Unpin for VarMap<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for VarMap<V>

§

impl<V> UnwindSafe for VarMap<V>
where V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.