Struct OrderedSet

Source
pub struct OrderedSet<K: Ord> { /* private fields */ }
Expand description

順序付き集合

Implementations§

Source§

impl<K: Ord> OrderedSet<K>

Source

pub fn new() -> Self

空のOrderedSetを返す。

Source

pub fn len(&self) -> usize

要素数を返す。

Source

pub fn is_empty(&self) -> bool

要素数が0ならばtrueを返す。

keyが存在するとき、それが何番目のキーであるかをOkで返す。 そうでないとき、仮にkeyがあったとき何番目のキーであったか、をErrで返す。

Source

pub fn max_le(&self, key: &K) -> Option<&K>

key以下の最大のキーをもつキーを返す。

Source

pub fn min_ge(&self, key: &K) -> Option<&K>

key以上の最小のキーをもつキーを返す。

Source

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

keyをキーとして持つならばtrueを返す。

Source

pub fn insert(&mut self, key: K) -> bool

keyが存在するとき、keyを挿入して、trueを返す。

Source

pub fn remove(&mut self, key: &K) -> bool

キーkeyがあれば、そのキーを削除して、trueを返す。

Source

pub fn get_by_index(&self, i: usize) -> Option<&K>

i番目のキーへの参照を返す。

Source

pub fn remove_by_index(&mut self, i: usize) -> Option<K>

i番目の要素を削除して、そのキーを返す。

Source

pub fn for_each(&self, f: impl FnMut(&K))

順序付き辞書のすべての要素を順番にfに渡す。

Trait Implementations§

Source§

impl<K: Default + Ord> Default for OrderedSet<K>

Source§

fn default() -> OrderedSet<K>

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

Auto Trait Implementations§

§

impl<K> !Freeze for OrderedSet<K>

§

impl<K> !RefUnwindSafe for OrderedSet<K>

§

impl<K> !Send for OrderedSet<K>

§

impl<K> !Sync for OrderedSet<K>

§

impl<K> Unpin for OrderedSet<K>

§

impl<K> UnwindSafe for OrderedSet<K>
where K: RefUnwindSafe,

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