Skip to main content

Error

Enum Error 

Source
pub enum Error {
    TooShort,
    Utf8Error,
    IncompleteRecord {
        expected: usize,
        actual: usize,
    },
    Io(Error),
    UnexpectedSeparator {
        expected: &'static [u8],
        actual: Vec<u8>,
    },
    FieldOverflow {
        field: &'static str,
        size: usize,
        actual: usize,
    },
    InvalidRange {
        field: &'static str,
        start: Vec<u8>,
        end: Vec<u8>,
    },
    SequenceError {
        fields: Vec<&'static str>,
        previous: Vec<Vec<u8>>,
        current: Vec<Vec<u8>>,
    },
    AlignmentError,
    ParseError,
}
Expand description

Errors that can occur while parsing or operating on fixed-width records. 固定長データのパース処理や操作中に発生するエラーを表します。

Variants§

§

TooShort

The input is shorter than the expected fixed width. 入力データの長さが、期待される固定長サイズよりも短い場合です。

This can happen when a 10-byte field receives only 5 bytes of data. 例えば、10バイト必要なフィールドに対して、5バイトのデータしか与えられなかった場合などに発生します。

§

Utf8Error

UTF-8 conversion failed for a byte field. バイト列から文字列(UTF-8)への変換に失敗した場合です。

This occurs when a fixed-width field contains invalid UTF-8 bytes. 固定長フィールド内に、UTF-8 として不正なバイトシーケンスが含まれている場合に発生します。

For encodings such as Shift_JIS, read the field as bytes and decode it separately. Shift_JIS など他のエンコーディングを扱う場合は、バイト列として取得し別途デコードしてください。

§

IncompleteRecord

The input ended in the middle of a fixed-width record. 固定長レコードの途中で入力が終わった場合です。

Fields

§expected: usize
§actual: usize
§

Io(Error)

An I/O error occurred while using Reader, Writer, or related operations. Reader / Writer などの I/O 処理中に発生したエラーです。

§

UnexpectedSeparator

A Reader found bytes that did not match the configured record separator. Reader が設定されたレコード区切りと一致しないバイト列を検出した場合です。

Fields

§expected: &'static [u8]
§actual: Vec<u8>
§

FieldOverflow

A field value exceeded the fixed width of the target field. フィールドに入れる値が固定長幅を超えた場合です。

Fields

§field: &'static str
§size: usize
§actual: usize
§

InvalidRange

A range search specified a start value greater than its end value. 範囲検索で開始値が終了値より大きく指定された場合です。

Fields

§field: &'static str
§start: Vec<u8>
§end: Vec<u8>
§

SequenceError

A Reader sequence check found a descending key or a forbidden duplicate key. Reader のシーケンスチェックで、現在レコードが前回レコードより小さい、または同一禁止設定で同一だった場合です。

Fields

§fields: Vec<&'static str>
§previous: Vec<Vec<u8>>
§current: Vec<Vec<u8>>
§

AlignmentError

§

ParseError

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

Formats the error as a short user-facing message. エラー内容を利用者向けの短いメッセージとして整形します。

Source§

impl Eq for Error

Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the wrapped I/O error as the source when one exists. ラップしている I/O エラーがあれば原因として返します。

1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(err: Error) -> Self

Converts a standard I/O error into a fixed-record error. 標準 I/O エラーを固定長レコード用エラーへ変換します。

Source§

impl PartialEq for Error

Source§

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

Compares I/O errors by ErrorKind and other errors by variant and payload. I/O エラーは ErrorKind で比較し、それ以外は variant と値で比較します。

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.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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> 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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.