pub enum ParseResult<'a, I, A> {
Success {
value: A,
length: usize,
},
Failure {
error: ParseError<'a, I>,
committed_status: CommittedStatus,
},
}
Expand description
The enum type representing the parse result.
解析結果を示す列挙型。
Variants§
Success
Success.
成功
Failure
Failure.
失敗
Fields
§
error: ParseError<'a, I>
The cause when failure.
失敗の原因
§
committed_status: CommittedStatus
The commit status.
コミット状態
Implementations§
Source§impl<'a, I, A> ParseResult<'a, I, A>
impl<'a, I, A> ParseResult<'a, I, A>
Sourcepub fn successful(value: A, length: usize) -> Self
pub fn successful(value: A, length: usize) -> Self
Returns the parse result of success.
成功の解析結果を返します。
-
value: a value
-
length: a size of the value
-
value: 値
-
length: 値のサイズ
Sourcepub fn failed(
error: ParseError<'a, I>,
committed_status: CommittedStatus,
) -> Self
pub fn failed( error: ParseError<'a, I>, committed_status: CommittedStatus, ) -> Self
Returns the parse result of failure.
失敗の解析結果を返します。
- error: a [ParsedError]
- committed_status: a CommittedStatus
Sourcepub fn failed_with_uncommitted(error: ParseError<'a, I>) -> Self
pub fn failed_with_uncommitted(error: ParseError<'a, I>) -> Self
Returns the parse result of failure.
失敗の解析結果を返します。
- error: a [ParsedError]
pub fn failed_with_commit(error: ParseError<'a, I>) -> Self
Sourcepub fn to_result(self) -> Result<A, ParseError<'a, I>>
pub fn to_result(self) -> Result<A, ParseError<'a, I>>
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns whether the parsing was successful or not.
解析が成功したかどうかを返す。
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Returns whether the parsing has failed or not.
解析が失敗したかどうかを返す。
Sourcepub fn failure(self) -> Option<ParseError<'a, I>>
pub fn failure(self) -> Option<ParseError<'a, I>>
Return the result of the failed parsing.
失敗した解析結果を返す。
Sourcepub fn committed_status(&self) -> Option<CommittedStatus>
pub fn committed_status(&self) -> Option<CommittedStatus>
Return the committed status.
コミット状態を返す。
Sourcepub fn with_uncommitted(self) -> Self
pub fn with_uncommitted(self) -> Self
失敗時のコミットを解除する
pub fn with_committed_fallback(self, is_committed: bool) -> Self
pub fn flat_map<B, F>(self, f: F) -> ParseResult<'a, I, B>
pub fn map<B, F>(self, f: F) -> ParseResult<'a, I, B>
pub fn map_err<F>(self, f: F) -> Self
pub fn with_add_length(self, n: usize) -> Self
Trait Implementations§
Source§impl<'a, I: Clone, A: Clone> Clone for ParseResult<'a, I, A>
impl<'a, I: Clone, A: Clone> Clone for ParseResult<'a, I, A>
Source§fn clone(&self) -> ParseResult<'a, I, A>
fn clone(&self) -> ParseResult<'a, I, A>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a, I, A> Freeze for ParseResult<'a, I, A>where
A: Freeze,
impl<'a, I, A> RefUnwindSafe for ParseResult<'a, I, A>where
A: RefUnwindSafe,
I: RefUnwindSafe,
impl<'a, I, A> Send for ParseResult<'a, I, A>
impl<'a, I, A> Sync for ParseResult<'a, I, A>
impl<'a, I, A> Unpin for ParseResult<'a, I, A>where
A: Unpin,
impl<'a, I, A> UnwindSafe for ParseResult<'a, I, A>where
A: UnwindSafe,
I: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more