[−][src]Struct p8n_types::Table
Table mapping hashable values to and from numeric indices.
Methods
impl<V: Hash + Debug + Clone + Eq, R: Clone + Copy + From<usize> + Into<usize>> Table<V, R>
[src]
pub fn with_capacity(cap: usize) -> Table<V, R>
[src]
Creates a new table with initial capacity cap
.
pub fn insert(&mut self, v: &V) -> R
[src]
Inserts v
into the table, returing its index. If v
already exists in the table its not inserted again.
pub fn index(&self, s: &V) -> Result<R>
[src]
Returns the index of s
in the table.
pub fn value<'a>(&'a self, i: R) -> Result<&'a V>
[src]
Returns the value of the entry with index i
.
pub fn len(&self) -> usize
[src]
Number of entries in the table.
impl Table<Name, NameRef>
[src]
pub fn base_name(&self, idx: NameRef) -> Result<NameRef>
[src]
Shortcut for getting the index of the Name
with the same base as idx
but subscript
None
.
pub fn var<S: Into<Str>>(
&mut self,
name: S,
subscript: Option<usize>,
bits: usize
) -> Result<Variable>
[src]
&mut self,
name: S,
subscript: Option<usize>,
bits: usize
) -> Result<Variable>
Create a new variable with name
and subscript
, inserting the name if it's not present
in the table.
impl Table<Name, SegmentRef>
[src]
pub fn base_name(&self, idx: SegmentRef) -> Result<SegmentRef>
[src]
Shortcut for getting the index of the Segment
with the same base as idx
but subscript
None
.
Trait Implementations
impl<V: Clone + Hash + Debug + Clone + Eq, R: Clone + Clone + Copy + From<usize> + Into<usize>> Clone for Table<V, R>
[src]
fn clone(&self) -> Table<V, R>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<V: Hash + Debug + Clone + Eq, R: Clone + Copy + From<usize> + Into<usize>> Default for Table<V, R>
[src]
impl<V: Debug + Hash + Debug + Clone + Eq, R: Debug + Clone + Copy + From<usize> + Into<usize>> Debug for Table<V, R>
[src]
Auto Trait Implementations
impl<V, R> Send for Table<V, R> where
R: Send,
V: Send,
R: Send,
V: Send,
impl<V, R> Sync for Table<V, R> where
R: Sync,
V: Sync,
R: Sync,
V: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,