pub struct WarningSink { /* private fields */ }Expand description
Internal accumulator used by parsers to record warnings.
Wraps a RefCell so the document-level accessor closures can
pass &WarningSink to parsers without juggling exclusive
references. Pushes are interior-mutable; the document’s
parse_warnings() accessor reads from the same cell.
Implementations§
Source§impl WarningSink
impl WarningSink
pub fn new() -> Self
Sourcepub fn push(&self, w: ParseWarning)
pub fn push(&self, w: ParseWarning)
Push a warning into the sink.
Sourcepub fn record(
&self,
phase: ParsePhase,
location: Option<LocationHint>,
severity: Severity,
message: impl Into<String>,
)
pub fn record( &self, phase: ParsePhase, location: Option<LocationHint>, severity: Severity, message: impl Into<String>, )
Convenience: build and push a warning with the given pieces.
Sourcepub fn borrow_slice(&self) -> Ref<'_, [ParseWarning]>
pub fn borrow_slice(&self) -> Ref<'_, [ParseWarning]>
Borrow the underlying slice for read-only access. Held borrow blocks further pushes until dropped, but parsers rarely hold this — they only push.
Trait Implementations§
Source§impl Debug for WarningSink
impl Debug for WarningSink
Source§impl Default for WarningSink
impl Default for WarningSink
Source§fn default() -> WarningSink
fn default() -> WarningSink
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for WarningSink
impl !RefUnwindSafe for WarningSink
impl !Sync for WarningSink
impl Send for WarningSink
impl Unpin for WarningSink
impl UnsafeUnpin for WarningSink
impl UnwindSafe for WarningSink
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> 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