pub struct ParseResult {
pub event: Option<PostfixLogEvent>,
pub confidence: f32,
pub parsing_errors: Vec<String>,
}
Expand description
解析结果
包含解析得到的事件、置信度和可能的错误信息
Fields§
§event: Option<PostfixLogEvent>
解析得到的事件,如果解析失败则为 None
confidence: f32
解析置信度 (0.0 - 1.0)
- 1.0: 完全匹配
- 0.7-0.9: 模糊匹配
- 0.3-0.6: 部分解析
- 0.0-0.2: 解析失败
parsing_errors: Vec<String>
解析过程中的错误和警告信息
Implementations§
Source§impl ParseResult
impl ParseResult
Sourcepub fn success(event: PostfixLogEvent, confidence: f32) -> Self
pub fn success(event: PostfixLogEvent, confidence: f32) -> Self
创建成功的解析结果
Sourcepub fn failure(error: ParseError) -> Self
pub fn failure(error: ParseError) -> Self
创建失败的解析结果
Sourcepub fn partial(
event: PostfixLogEvent,
confidence: f32,
warnings: Vec<String>,
) -> Self
pub fn partial( event: PostfixLogEvent, confidence: f32, warnings: Vec<String>, ) -> Self
创建部分成功的解析结果
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
检查解析是否成功
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
检查解析是否完全失败
Sourcepub fn main_error(&self) -> Option<&String>
pub fn main_error(&self) -> Option<&String>
获取主要错误(如果有的话)
Trait Implementations§
Source§impl Clone for ParseResult
impl Clone for ParseResult
Source§fn clone(&self) -> ParseResult
fn clone(&self) -> ParseResult
Returns a duplicate 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 Freeze for ParseResult
impl RefUnwindSafe for ParseResult
impl Send for ParseResult
impl Sync for ParseResult
impl Unpin for ParseResult
impl UnwindSafe for ParseResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more