[−][src]Struct tweep::Warning
A warning with a WarningKind
, Position
, and optionally a reference
to another Position
Examples
use tweep::{FullContext, Warning, WarningKind}; let warning = Warning::new(WarningKind::DuplicateStoryTitle, Some(context)) .with_referent(referent);
Fields
kind: WarningKind
The warning type
context: Option<Context>
The context of this Warning
referent: Option<Context>
The location referenced by this warning
Implementations
impl Warning
[src]
pub fn new<T: Into<Context>>(kind: WarningKind, context: Option<T>) -> Self
[src]
Creates a new Warning
with a default Position
and no referent
Examples
use tweep::{FullContext, Warning, WarningKind}; let warning = Warning::new(WarningKind::MissingStartPassage, Some(context));
pub fn has_referent(&self) -> bool
[src]
Returns true
if this Warning
has a referent
Examples
use tweep::{FullContext, Warning, WarningKind}; let mut warning = Warning::new(WarningKind::UnclosedLink, Some(context)); assert!(!warning.has_referent()); warning.set_referent(referent); assert!(warning.has_referent());
pub fn get_referent(&self) -> Option<&Context>
[src]
Gets the referent if one exists
Examples
let warning = Warning::new(WarningKind::DuplicateStoryTitle, Some(context)) .with_referent(referent.clone()); assert_eq!(warning.get_referent(), Some(&referent));
pub fn set_referent<T: Into<Context>>(&mut self, referent: T)
[src]
Sets the referent to the given Position
Examples
let mut warning = Warning::new(WarningKind::DuplicateStoryTitle, Some(context)); warning.set_referent(referent.clone()); assert_eq!(warning.get_referent(), Some(&referent));
pub fn with_referent<T: Into<Context>>(self, referent: T) -> Self
[src]
Moves the object, sets the referent to the given Position
, and returns
the modified object
Examples
let warning = Warning::new(WarningKind::DuplicateStoryTitle, Some(context)) .with_referent(referent.clone()); assert_eq!(warning.get_referent(), Some(&referent));
Trait Implementations
impl Clone for Warning
[src]
impl Debug for Warning
[src]
impl Display for Warning
[src]
impl Eq for Warning
[src]
impl PartialEq<Warning> for Warning
[src]
impl StructuralEq for Warning
[src]
impl StructuralPartialEq for Warning
[src]
Auto Trait Implementations
impl RefUnwindSafe for Warning
impl Send for Warning
impl Sync for Warning
impl Unpin for Warning
impl UnwindSafe for Warning
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,