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. 固定長レコードの途中で入力が終わった場合です。
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 が設定されたレコード区切りと一致しないバイト列を検出した場合です。
FieldOverflow
A field value exceeded the fixed width of the target field. フィールドに入れる値が固定長幅を超えた場合です。
InvalidRange
A range search specified a start value greater than its end value. 範囲検索で開始値が終了値より大きく指定された場合です。
SequenceError
A Reader sequence check found a descending key or a forbidden duplicate key.
Reader のシーケンスチェックで、現在レコードが前回レコードより小さい、または同一禁止設定で同一だった場合です。
AlignmentError
ParseError
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
use the Display impl or to_string()