Skip to main content

TestRecord

Struct TestRecord 

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

Test record used to document the generated fixed-record API. 生成される fixed-record API のドキュメント用テストレコードです。

Implementations§

Source§

impl TestRecord

Source

pub const TOTAL_LEN: usize = 23usize

Total byte length of the record. レコード全体の合計バイト長です。

Source

pub const CLEAR_BYTE: u8 = 32u8

Byte value used by set_field_* methods to clear a field before writing. set_field_* が書き込み前にフィールドをクリアするときのバイト値です。

Source

pub const FIELD_SIZE_NAME: usize = 10usize

Byte length constant for the field. フィールドのバイト長定数です。

Source

pub const FIELD_SIZE_CODE: usize = 5usize

Byte length constant for the field. フィールドのバイト長定数です。

Source

pub const FIELD_SIZE_AMOUNT: usize = 8usize

Byte length constant for the field. フィールドのバイト長定数です。

Source

pub fn name(&self) -> &[u8] ⓘ

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Returns the field as bytes. フィールドをバイト列として返します。

Source

pub fn name_str(&self) -> Result<&str, Error>

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Returns the field as a UTF-8 string. フィールドを UTF-8 文字列として参照します。

Source

pub fn with_name(self, s: &str) -> Self

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Overwrites the field from the beginning with a string. フィールドに文字列を先頭から上書きします。 The field is not cleared before writing, so shorter strings leave trailing bytes intact. 書き込み前のクリアは行わないため、短い文字列では後続バイトが残ります。

Source

pub fn with_name_int(self, val: i64) -> Self

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Sets the field to a zero-padded numeric string. フィールドに数値をゼロ埋め文字列としてセットします。 Values wider than the field are truncated and reported to stderr. 値がフィールド幅を超える場合は切り捨て、stderr に警告を出します。

Source

pub fn try_with_name_int(self, val: i64) -> Result<Self, Error>

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Sets the field to a zero-padded numeric string. フィールドに数値をゼロ埋め文字列としてセットします。 Returns Error::FieldOverflow when the value is wider than the field. 値がフィールド幅を超える場合は Error::FieldOverflow を返します。

Source

pub fn with_name_int_truncated(self, val: i64) -> Self

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Sets the field to a zero-padded numeric string and keeps only the leading bytes when it overflows. フィールドに数値をゼロ埋め文字列としてセットし、幅を超えた場合は先頭側だけ残します。 Truncation is reported to stderr. 切り捨てが発生した場合は stderr に警告を出します。

Source

pub fn with_name_int_signed(self, val: i64) -> Self

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Sets the field to a zero-padded signed numeric string prefixed with + or -. フィールドに符号付き数値を + または - を先頭にしてゼロ埋めでセットします。 Values wider than the field are truncated and reported to stderr. 値がフィールド幅を超える場合は切り捨て、stderr に警告を出します。

Source

pub fn try_with_name_int_signed(self, val: i64) -> Result<Self, Error>

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Sets the field to a zero-padded signed numeric string prefixed with + or -. フィールドに符号付き数値を + または - を先頭にしてゼロ埋めでセットします。 Returns Error::FieldOverflow when the value is wider than the field. 値がフィールド幅を超える場合は Error::FieldOverflow を返します。

Source

pub fn with_name_int_signed_truncated(self, val: i64) -> Self

Name field used by generated API tests. 生成 API テストで使う名前フィールドです。 Sets the field to a signed numeric string and keeps only the leading bytes when it overflows. フィールドに符号付き数値をセットし、幅を超えた場合は先頭側だけ残します。 Truncation is reported to stderr. 切り捨てが発生した場合は stderr に警告を出します。

Source

pub fn code(&self) -> &[u8] ⓘ

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Returns the field as bytes. フィールドをバイト列として返します。

Source

pub fn code_str(&self) -> Result<&str, Error>

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Returns the field as a UTF-8 string. フィールドを UTF-8 文字列として参照します。

Source

pub fn with_code(self, s: &str) -> Self

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Overwrites the field from the beginning with a string. フィールドに文字列を先頭から上書きします。 The field is not cleared before writing, so shorter strings leave trailing bytes intact. 書き込み前のクリアは行わないため、短い文字列では後続バイトが残ります。

Source

pub fn with_code_int(self, val: i64) -> Self

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Sets the field to a zero-padded numeric string. フィールドに数値をゼロ埋め文字列としてセットします。 Values wider than the field are truncated and reported to stderr. 値がフィールド幅を超える場合は切り捨て、stderr に警告を出します。

Source

pub fn try_with_code_int(self, val: i64) -> Result<Self, Error>

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Sets the field to a zero-padded numeric string. フィールドに数値をゼロ埋め文字列としてセットします。 Returns Error::FieldOverflow when the value is wider than the field. 値がフィールド幅を超える場合は Error::FieldOverflow を返します。

Source

pub fn with_code_int_truncated(self, val: i64) -> Self

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Sets the field to a zero-padded numeric string and keeps only the leading bytes when it overflows. フィールドに数値をゼロ埋め文字列としてセットし、幅を超えた場合は先頭側だけ残します。 Truncation is reported to stderr. 切り捨てが発生した場合は stderr に警告を出します。

Source

pub fn with_code_int_signed(self, val: i64) -> Self

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Sets the field to a zero-padded signed numeric string prefixed with + or -. フィールドに符号付き数値を + または - を先頭にしてゼロ埋めでセットします。 Values wider than the field are truncated and reported to stderr. 値がフィールド幅を超える場合は切り捨て、stderr に警告を出します。

Source

pub fn try_with_code_int_signed(self, val: i64) -> Result<Self, Error>

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Sets the field to a zero-padded signed numeric string prefixed with + or -. フィールドに符号付き数値を + または - を先頭にしてゼロ埋めでセットします。 Returns Error::FieldOverflow when the value is wider than the field. 値がフィールド幅を超える場合は Error::FieldOverflow を返します。

Source

pub fn with_code_int_signed_truncated(self, val: i64) -> Self

Code field used by generated API tests. 生成 API テストで使うコードフィールドです。 Sets the field to a signed numeric string and keeps only the leading bytes when it overflows. フィールドに符号付き数値をセットし、幅を超えた場合は先頭側だけ残します。 Truncation is reported to stderr. 切り捨てが発生した場合は stderr に警告を出します。

Source

pub fn amount(&self) -> &[u8] ⓘ

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Returns the field as bytes. フィールドをバイト列として返します。

Source

pub fn amount_str(&self) -> Result<&str, Error>

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Returns the field as a UTF-8 string. フィールドを UTF-8 文字列として参照します。

Source

pub fn with_amount(self, s: &str) -> Self

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Overwrites the field from the beginning with a string. フィールドに文字列を先頭から上書きします。 The field is not cleared before writing, so shorter strings leave trailing bytes intact. 書き込み前のクリアは行わないため、短い文字列では後続バイトが残ります。

Source

pub fn with_amount_int(self, val: i64) -> Self

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Sets the field to a zero-padded numeric string. フィールドに数値をゼロ埋め文字列としてセットします。 Values wider than the field are truncated and reported to stderr. 値がフィールド幅を超える場合は切り捨て、stderr に警告を出します。

Source

pub fn try_with_amount_int(self, val: i64) -> Result<Self, Error>

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Sets the field to a zero-padded numeric string. フィールドに数値をゼロ埋め文字列としてセットします。 Returns Error::FieldOverflow when the value is wider than the field. 値がフィールド幅を超える場合は Error::FieldOverflow を返します。

Source

pub fn with_amount_int_truncated(self, val: i64) -> Self

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Sets the field to a zero-padded numeric string and keeps only the leading bytes when it overflows. フィールドに数値をゼロ埋め文字列としてセットし、幅を超えた場合は先頭側だけ残します。 Truncation is reported to stderr. 切り捨てが発生した場合は stderr に警告を出します。

Source

pub fn with_amount_int_signed(self, val: i64) -> Self

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Sets the field to a zero-padded signed numeric string prefixed with + or -. フィールドに符号付き数値を + または - を先頭にしてゼロ埋めでセットします。 Values wider than the field are truncated and reported to stderr. 値がフィールド幅を超える場合は切り捨て、stderr に警告を出します。

Source

pub fn try_with_amount_int_signed(self, val: i64) -> Result<Self, Error>

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Sets the field to a zero-padded signed numeric string prefixed with + or -. フィールドに符号付き数値を + または - を先頭にしてゼロ埋めでセットします。 Returns Error::FieldOverflow when the value is wider than the field. 値がフィールド幅を超える場合は Error::FieldOverflow を返します。

Source

pub fn with_amount_int_signed_truncated(self, val: i64) -> Self

Amount field used by generated API tests. 生成 API テストで使う金額フィールドです。 Sets the field to a signed numeric string and keeps only the leading bytes when it overflows. フィールドに符号付き数値をセットし、幅を超えた場合は先頭側だけ残します。 Truncation is reported to stderr. 切り捨てが発生した場合は stderr に警告を出します。

Source

pub const fn size_of(field: TestRecordField) -> usize

Returns the byte length of the specified field. 指定したフィールドのバイト長を返します。

Source

pub const fn offset_of(field: TestRecordField) -> usize

Returns the byte offset from the start of the record to the specified field. レコードの先頭から指定したフィールドまでのバイトオフセットを返します。

Source

pub const fn name_of(field: TestRecordField) -> &'static str

Returns the declaration name of the specified field. 指定したフィールドの定義名を文字列として返します。

Source

pub const fn all_fields() -> &'static [TestRecordField]

Returns all fields defined on this struct. この構造体に定義されているすべてのフィールドのリストを返します。

Source

pub const fn zeroed() -> Self

Creates a new record with every field filled with 0x00. 全フィールドを 0x00 で埋めた新しいインスタンスを生成します。

Source

pub const fn spaced() -> Self

Creates a new record with every field filled with spaces (0x20). 全フィールドをスペース (0x20) で埋めた新しいインスタンスを生成します。

Source

pub const fn cleared() -> Self

Creates a new record with every field filled with CLEAR_BYTE. 全フィールドを CLEAR_BYTE で埋めた新しいインスタンスを生成します。

Source

pub fn to_bytes(&self) -> [u8; 23]

Copies the record into a fixed-width byte array. インスタンスを固定長バイト配列としてコピーして返します。

Source

pub const fn byte_len(&self) -> usize

Returns the total byte length of this record. インスタンスの合計バイト長を返します。

Source

pub fn byte_len_fields(fields: &[TestRecordField]) -> usize

Returns the total byte length of the specified fields. 指定されたフィールドリストの合計バイト長を返します。

Source

pub fn builder() -> Self

Creates a new builder value initialized with CLEAR_BYTE. CLEAR_BYTE で初期化した新しいビルダーインスタンスを生成します。

Source

pub fn build(self) -> Self

Finishes building and returns the record value. ビルドを完了し、インスタンスを返します。

Source

pub fn parse(src: &[u8]) -> Result<Self, Error>

Reads bytes and creates a new owned record value. バイト列を読み取って、構造体の新しいインスタンス(所有権あり)を作成します。

Source

pub fn parse_str(src: &str) -> Result<Self, Error>

Converts a string into a record by reading it as bytes. 文字列をバイト列として読み取り、構造体へ変換します。

Source

pub fn ref_from_str(src: &str) -> Result<&Self, Error>

Reads a string as a zero-copy shared reference when it is exactly one record wide. 文字列を、ちょうど1レコード分の幅である場合にコピーせず共有参照として読み取ります。

Source

pub fn ref_from_bytes_prefix(src: &[u8]) -> Result<&Self, Error>

Reads the first record-width bytes as a zero-copy shared reference. 先頭の1レコード分のバイト列を、コピーせず共有参照として読み取ります。 Unlike zerocopy::FromBytes::ref_from_bytes, extra trailing bytes are accepted. zerocopy::FromBytes::ref_from_bytes と異なり、後続の余りバイトを許容します。

Source

pub fn ref_from_str_prefix(src: &str) -> Result<&Self, Error>

Reads the first record-width bytes of a string as a zero-copy shared reference. 文字列の先頭1レコード分のバイト列を、コピーせず共有参照として読み取ります。

Source

pub fn get_field_bytes(&self, field: TestRecordField) -> &[u8] ⓘ

Returns the raw bytes of the specified field. 指定フィールドの生バイト列を返します。

Source

pub fn get_field_str(&self, field: TestRecordField) -> Result<&str, Error>

Returns the specified field as a string after UTF-8 validation. 指定フィールドを文字列として取得します(UTF-8チェック)。

Source

pub fn get_field_trimmed(&self, field: TestRecordField) -> Result<&str, Error>

Returns a string slice with leading and trailing spaces or NUL bytes removed. フィールドから前後の空白やヌル文字を取り除いた文字列スライスを取得します。

Source

pub fn get_field_string_trimmed( &self, field: TestRecordField, ) -> Result<String, Error>

Returns the specified field as a trimmed String. 指定フィールドをトリミング済みの String として取得します。

Source

pub fn get_field_as<T: FromStr>( &self, field: TestRecordField, ) -> Result<T, Error>

Trims the field and parses it into any FromStr type. フィールドをトリミングした後、任意の FromStr 型にパースして取得します。

Source

pub fn as_str(&self) -> Result<&str, Error>

Returns the whole record as a UTF-8 string slice. レコード全体を UTF-8 文字列スライスとして返します。

Source

pub fn fill_field_zero(&mut self, field: TestRecordField)

Fills the specified field with 0x00 bytes. 指定したフィールドを 0x00 で埋めます。

Source

pub fn fill_field_space(&mut self, field: TestRecordField)

Fills the specified field with spaces (0x20). 指定したフィールドを半角スペース (0x20) で埋めます。

Source

pub fn fill_field_clear(&mut self, field: TestRecordField)

Fills the specified field with CLEAR_BYTE. 指定したフィールドを CLEAR_BYTE で埋めます。

Source

pub fn set_field_bytes(&mut self, field: TestRecordField, data: &[u8])

Clears the specified field with CLEAR_BYTE and then writes bytes into it. 特定フィールドを CLEAR_BYTE でクリアしてからバイト列を書き込みます。

Source

pub fn set_field_bytes_no_clear(&mut self, field: TestRecordField, data: &[u8])

Overwrites the specified field from the beginning with bytes. 特定フィールドにバイト列を先頭から上書きします。 The field is not cleared before writing, so shorter inputs leave trailing bytes intact. 書き込み前のクリアは行わないため、短い入力では後続バイトが残ります。

Source

pub fn set_field_str(&mut self, field: TestRecordField, s: &str)

Clears the specified field with CLEAR_BYTE and then writes a string into it. 特定フィールドを CLEAR_BYTE でクリアしてから文字列を書き込みます。

Source

pub fn set_field_str_no_clear(&mut self, field: TestRecordField, s: &str)

Overwrites the specified field from the beginning with a string. 特定フィールドに文字列を先頭から上書きします。 The field is not cleared before writing, so shorter strings leave trailing bytes intact. 書き込み前のクリアは行わないため、短い文字列では後続バイトが残ります。

Source

pub fn fill_zero(&mut self)

Fills all fields with 0x00 bytes. すべてのフィールドを 0x00 で一括上書きします。

Source

pub fn fill_space(&mut self)

Fills all fields with spaces (0x20). すべてのフィールドを半角スペース (0x20) で一括上書きします。

Source

pub fn apply<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Passes self to a closure for method-chain friendly mutation. 自身をクロージャに渡して加工する、メソッドチェーン向けの汎用メソッドです。

Source

pub fn apply_bytes(self, data: &[u8]) -> Self

Applies bytes field by field from the first field. 先頭フィールドから順に、渡されたバイト列を各フィールドの長さ分ずつ流し込みます。

Source

pub fn apply_str(self, s: &str) -> Self

Applies a string field by field from the first field. 先頭フィールドから順に、渡された文字列を流し込みます。

Source

pub fn apply_bytes_from(self, start_field: TestRecordField, data: &[u8]) -> Self

Applies bytes sequentially from the specified starting field. 開始フィールドを指定して、そこから順次データを流し込みます。

Source

pub fn apply_str_from(self, start_field: TestRecordField, s: &str) -> Self

Applies string data sequentially from the specified starting field. 開始フィールドを指定して、そこから順次文字列データを流し込みます。

Source

pub fn compare_all_fields(&self, other: &Self) -> Ordering

Compares all fields in declaration order. 全フィールドを定義順に比較します。

Source

pub fn compare_by_fields( &self, other: &Self, fields: &[TestRecordField], ) -> Ordering

Compares records using the specified field priority order. 指定されたフィールドの優先順に従って比較します。

Source

pub fn dump(&self)

Dumps all fields of the record to standard output. レコードの全フィールドを標準出力へダンプします。

Source

pub fn to_dump_string(&self) -> String

Returns all fields of the record as a dump string. レコードの全フィールドをダンプ文字列として返します。

Trait Implementations§

Source§

impl Clone for TestRecord

Source§

fn clone(&self) -> TestRecord

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 Copy for TestRecord

Source§

impl Debug for TestRecord

Source§

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

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

impl Default for TestRecord

Source§

fn default() -> Self

Calls cleared() to initialize the record with CLEAR_BYTE. cleared() を呼び出して CLEAR_BYTE で初期化します。

Source§

impl Eq for TestRecord

Source§

impl FixedRecord for TestRecord

Source§

fn parse(src: &[u8]) -> Result<Self, Error>

Creates a record from fixed-width bytes. 固定長バイト列からレコードを作成します。

Source§

fn to_bytes(&self) -> Vec<u8> ⓘ

Copies the record as fixed-width bytes. レコードを固定長バイト列としてコピーして返します。

Source§

fn field_name(field: Self::Field) -> &'static str

Returns the declaration name of the specified field. 指定フィールドの定義名を返します。

Source§

fn field_bytes(&self, field: Self::Field) -> &[u8] ⓘ

Returns the bytes stored in the specified field. 指定フィールドのバイト列を返します。

Source§

const TOTAL_LEN: usize = TestRecord::TOTAL_LEN

Total byte length of the record. レコード全体のバイト長です。
Source§

type Field = TestRecordField

The field enum type that can be used for sequence checks. シーケンスチェックで指定できるフィールド enum の型です。
Source§

impl FromBytes for TestRecord

§

fn ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the given source as a &Self. Read more
§

fn ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the prefix of the given source as a &Self without copying. Read more
§

fn ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: Immutable + KnownLayout,

Interprets the suffix of the given bytes as a &Self. Read more
§

fn mut_from_bytes( source: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the given source as a &mut Self. Read more
§

fn mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the prefix of the given source as a &mut Self without copying. Read more
§

fn mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the suffix of the given source as a &mut Self without copying. Read more
§

fn ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &Self with a DST length equal to count. Read more
§

fn ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the prefix of the given source as a DST &Self with length equal to count. Read more
§

fn ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the suffix of the given source as a DST &Self with length equal to count. Read more
§

fn mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &mut Self with a DST length equal to count. Read more
§

fn mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the prefix of the given source as a &mut Self with DST length equal to count. Read more
§

fn mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the suffix of the given source as a &mut Self with DST length equal to count. Read more
§

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source. Read more
§

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source. Read more
§

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source. Read more
Source§

impl FromZeros for TestRecord
where Fixed<10>: FromZeros, Fixed<5>: FromZeros, Fixed<8>: FromZeros,

§

fn zero(&mut self)

Overwrites self with zeros. Read more
§

fn new_zeroed() -> Self
where Self: Sized,

Creates an instance of Self from zeroed bytes. Read more
Source§

impl Immutable for TestRecord

Source§

impl IntoBytes for TestRecord
where Fixed<10>: IntoBytes, Fixed<5>: IntoBytes, Fixed<8>: IntoBytes, (): PaddingFree<Self, { _ }>,

§

fn as_bytes(&self) -> &[u8] ⓘ
where Self: Immutable,

Gets the bytes of this value. Read more
§

fn as_mut_bytes(&mut self) -> &mut [u8] ⓘ
where Self: FromBytes,

Gets the bytes of this value mutably. Read more
§

fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to dst. Read more
§

fn write_to_prefix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the prefix of dst. Read more
§

fn write_to_suffix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the suffix of dst. Read more
Source§

impl KnownLayout for TestRecord
where Fixed<8>: KnownLayout,

Source§

type PointerMetadata = <Fixed<8> as KnownLayout>::PointerMetadata

The type of metadata stored in a pointer to Self. Read more
§

fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>

Computes the size of an object of type Self with the given pointer metadata. Read more
Source§

impl PartialEq for TestRecord

Source§

fn eq(&self, other: &TestRecord) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 RecordWithList for TestRecord

Source§

type List = TestRecordList

Generated List type that can be built from these records. このレコード列から構築できる生成済み List 型です。
Source§

impl SequenceFields<TestRecord> for [TestRecordField; 0]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl<'a> SequenceFields<TestRecord> for &'a [TestRecordField; 0]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl SequenceFields<TestRecord> for [TestRecordField; 1]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl<'a> SequenceFields<TestRecord> for &'a [TestRecordField; 1]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl SequenceFields<TestRecord> for [TestRecordField; 2]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl<'a> SequenceFields<TestRecord> for &'a [TestRecordField; 2]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl SequenceFields<TestRecord> for [TestRecordField; 3]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl<'a> SequenceFields<TestRecord> for &'a [TestRecordField; 3]

Source§

fn to_sequence_fields(self) -> Vec<TestRecordField>

Returns the fields used by Reader sequence checks as a Vec. Reader のシーケンスチェック対象フィールドを Vec にして返します。

Source§

impl StructuralPartialEq for TestRecord

Source§

impl TryFromBytes for TestRecord
where Fixed<10>: TryFromBytes, Fixed<5>: TryFromBytes, Fixed<8>: TryFromBytes,

§

fn try_ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the given source as a &Self. Read more
§

fn try_ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the prefix of the given source as a &Self. Read more
§

fn try_ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the suffix of the given source as a &Self. Read more
§

fn try_mut_from_bytes( bytes: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the given source as a &mut Self without copying. Read more
§

fn try_mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self. Read more
§

fn try_mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self. Read more
§

fn try_ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the given source as a &Self with a DST length equal to count. Read more
§

fn try_ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the prefix of the given source as a &Self with a DST length equal to count. Read more
§

fn try_ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the suffix of the given source as a &Self with a DST length equal to count. Read more
§

fn try_mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the given source as a &mut Self with a DST length equal to count. Read more
§

fn try_mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self with a DST length equal to count. Read more
§

fn try_mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self with a DST length equal to count. Read more
§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<A, T> Read<A, BecauseImmutable> for T
where A: Aliasing, T: Immutable + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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