pub struct Extra(/* private fields */);Expand description
Werkzeugspezifische Beigabe an einem Finding oder
RuleRun. Nie serialisiert.
use a11y_report::{Extra, Finding};
struct Screenshot(Vec<u8>);
let f = Finding::fail("images/alt-missing", "kein alt")
.with_extra(Screenshot(vec![0x89, 0x50, 0x4e, 0x47]));
assert_eq!(f.extra.get::<Screenshot>().map(|s| s.0.len()), Some(4));
// Eine andere Sorte liegt nicht darin.
assert!(f.extra.get::<String>().is_none());Implementations§
Source§impl Extra
impl Extra
Sourcepub fn new<T: Any + Send + Sync>(value: T) -> Self
pub fn new<T: Any + Send + Sync>(value: T) -> Self
Legt einen Wert ab. Ein bereits vorhandener wird ersetzt; der Slot hält genau eine Sorte. Wer mehreres anhängen will, legt eine eigene Struktur hinein.
Sourcepub fn get<T: Any + Send + Sync>(&self) -> Option<&T>
pub fn get<T: Any + Send + Sync>(&self) -> Option<&T>
Holt den Wert zurück, wenn er von der erwarteten Sorte ist.
pub fn is_empty(&self) -> bool
Trait Implementations§
impl Eq for Extra
Auto Trait Implementations§
impl !RefUnwindSafe for Extra
impl !UnwindSafe for Extra
impl Freeze for Extra
impl Send for Extra
impl Sync for Extra
impl Unpin for Extra
impl UnsafeUnpin for Extra
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