pub struct DiagnosticSet { /* private fields */ }Expand description
A collection of diagnostics.
Implementations§
Source§impl DiagnosticSet
impl DiagnosticSet
Sourcepub fn new() -> DiagnosticSet
pub fn new() -> DiagnosticSet
Creates a new empty diagnostic set.
Sourcepub fn add(&mut self, diagnostic: Diagnostic)
pub fn add(&mut self, diagnostic: Diagnostic)
Sourcepub fn extend(&mut self, diagnostics: impl IntoIterator<Item = Diagnostic>)
pub fn extend(&mut self, diagnostics: impl IntoIterator<Item = Diagnostic>)
Adds multiple diagnostics to the set.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Diagnostic>
pub fn iter(&self) -> impl Iterator<Item = &Diagnostic>
Returns an iterator over the diagnostics.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Returns true if there are any errors in the set.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of diagnostics.
Examples found in repository?
examples/workflow.rs (line 31)
7fn main() -> Result<(), Box<dyn Error>> {
8 let input = r#"#VRML_SIM R2025a utf8
9
10PROTO ContextAwareBox [
11 field SFInt32 count 2
12 field SFString label "default-label"
13]
14{
15 Group {
16 children [
17 WorldInfo { title "%<= fields.label.value >%|%<= fields.label.defaultValue >%|%<= context.os >%" }
18 %< for (let i = 0; i < fields.count.value; ++i) { >%
19 Transform {
20 translation %<= i >% 0 0
21 children [ Box { size 0.5 0.5 0.5 } ]
22 }
23 %< } >%
24 ]
25 }
26}
27"#;
28
29 let document: Proto = input.parse()?;
30 let diagnostics = document.validate()?;
31 println!("diagnostics: {}", diagnostics.len());
32
33 let mut field_overrides = HashMap::new();
34 field_overrides.insert("count".to_string(), TemplateField::SFInt32(3));
35 field_overrides.insert(
36 "label".to_string(),
37 TemplateField::SFString("override-label".to_string()),
38 );
39
40 let context = RenderContext::default()
41 .with_os("linux")
42 .with_world("/workspace/worlds/example.wbt")
43 .with_webots_version(RenderWebotsVersion::new(
44 "R2025a".to_string(),
45 "0".to_string(),
46 ));
47
48 let options = RenderOptions::default()
49 .with_field_overrides(field_overrides)
50 .with_context(context);
51
52 let rendered = document.render(&options)?;
53 println!("{rendered}");
54
55 Ok(())
56}Trait Implementations§
Source§impl Clone for DiagnosticSet
impl Clone for DiagnosticSet
Source§fn clone(&self) -> DiagnosticSet
fn clone(&self) -> DiagnosticSet
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 moreSource§impl Debug for DiagnosticSet
impl Debug for DiagnosticSet
Source§impl Default for DiagnosticSet
impl Default for DiagnosticSet
Source§fn default() -> DiagnosticSet
fn default() -> DiagnosticSet
Returns the “default value” for a type. Read more
Source§impl IntoIterator for DiagnosticSet
impl IntoIterator for DiagnosticSet
Source§type Item = Diagnostic
type Item = Diagnostic
The type of the elements being iterated over.
Source§type IntoIter = IntoIter<Diagnostic>
type IntoIter = IntoIter<Diagnostic>
Which kind of iterator are we turning this into?
Source§fn into_iter(self) -> <DiagnosticSet as IntoIterator>::IntoIter
fn into_iter(self) -> <DiagnosticSet as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
Auto Trait Implementations§
impl Freeze for DiagnosticSet
impl RefUnwindSafe for DiagnosticSet
impl Send for DiagnosticSet
impl Sync for DiagnosticSet
impl Unpin for DiagnosticSet
impl UnsafeUnpin for DiagnosticSet
impl UnwindSafe for DiagnosticSet
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.