Table

Struct Table 

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

テーブル構造を定義します。

Implementations§

Source§

impl Table

Source

pub fn new() -> Self

空のテーブルを作成します。

Source

pub fn insert_value<T: Display>(&mut self, key: &str, value: T)

指定したキーに値を挿入します。

Source

pub fn insert_table(&mut self, key: &str, table: Table)

指定したキーにサブテーブルを挿入します。

Source

pub fn remove_value(&mut self, key: &str)

指定したキーの値を削除します。

Source

pub fn remove_table(&mut self, key: &str)

指定したキーのサブテーブルを削除します。

Source

pub fn get_value(&self, key: &str) -> Option<&String>

指定したキーの値を文字列として読み取ります。

Source

pub fn parse_value<T: FromTableValue>( &self, key: &str, ) -> Option<Result<T, T::Err>>

指定したキーの値をパースして読み取ります。

Source

pub fn get_value_mut(&mut self, key: &str) -> Option<&mut String>

指定したキーの値への可変参照を取得します。

Source

pub fn get_table(&self, key: &str) -> Option<&Table>

指定したキーのサブテーブルを取得します。

Source

pub fn get_table_mut(&mut self, key: &str) -> Option<&mut Table>

指定したキーのサブテーブルへの可変参照を取得します。

Source

pub fn merge(&mut self, other: &Table)

別のテーブルをマージします。

Source

pub fn values<'a>(&'a self) -> TableValuesIterator<'a>

値を列挙するイテレーターを返します。

Source

pub fn values_mut<'a>(&'a mut self) -> TableValuesIteratorMut<'a>

可変参照で値を列挙します。

Source

pub fn is_values_empty(&self) -> bool

値が空かどうかを返します。

Source

pub fn subtables<'a>(&'a self) -> SubTablesIterator<'a>

子テーブルを列挙するイテレーターを返します。

Source

pub fn subtables_mut<'a>(&'a mut self) -> SubTablesIteratorMut<'a>

子テーブルを可変参照で列挙します。

Source

pub fn is_subtables_empty(&self) -> bool

子テーブルが空かどうかを返します。

Source

pub fn iter_subtables_as_array<'a>(&'a self) -> ArraySubTablesIterator<'a>

012…のキーを持つ子テーブルを配列として列挙するイテレーターを返します。

Source

pub fn write_table(&self, f: &mut impl Write, prefix: Option<&str>) -> Result

テーブルを文字列として書き出します。

prefixはサブテーブルの名前の接頭辞として使用されます。 具体的には、${prefix}.${key}の形式でサブテーブルの名前が生成されます。

Trait Implementations§

Source§

impl Clone for Table

Source§

fn clone(&self) -> Table

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Table

Source§

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

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

impl Default for Table

Source§

fn default() -> Table

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

impl Display for Table

Source§

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

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

impl FromStr for Table

Source§

type Err = TableParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Table

Source§

fn eq(&self, other: &Table) -> 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 Eq for Table

Source§

impl StructuralPartialEq for Table

Auto Trait Implementations§

§

impl Freeze for Table

§

impl RefUnwindSafe for Table

§

impl Send for Table

§

impl Sync for Table

§

impl Unpin for Table

§

impl UnwindSafe for Table

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
§

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

§

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

Checks if this value is equivalent to the given key. Read more
§

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

§

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

Compare self to key and return true if they are equal.
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> 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> 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, 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.