pub struct Span { /* private fields */ }Expand description
The position of an expansion in a Scratch arena.
Spans compare equal, and hash alike, when they have the same position and length, whatever their contents. A span is meaningful only for the arena that created it; see the module documentation.
§Examples
use implicit_predicates_core::Scratch;
let mut buf = [0.0; 4];
let mut scratch = Scratch::borrowed(&mut buf);
let span = scratch.push(&[1e-20, 1.0])?;
assert_eq!(span.len(), 2);
assert_eq!(scratch.get(span), &[1e-20, 1.0]);Implementations§
Source§impl Span
impl Span
Sourcepub fn len(self) -> usize
pub fn len(self) -> usize
Returns the number of components of the expansion.
§Examples
use implicit_predicates_core::Scratch;
let mut buf = [0.0; 2];
let mut scratch = Scratch::borrowed(&mut buf);
assert_eq!(scratch.push(&[1e-20, 1.0])?.len(), 2);Sourcepub fn is_empty(self) -> bool
pub fn is_empty(self) -> bool
Returns true if the expansion has no components, that is, if its
value is zero.
§Examples
use implicit_predicates_core::Scratch;
let mut buf = [0.0; 6];
let mut scratch = Scratch::borrowed(&mut buf);
let a = scratch.push(&[1e-20, 1.0])?;
assert!(scratch.diff(a, a)?.is_empty());Trait Implementations§
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Forget for Span
impl Freeze for Span
impl Move for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
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