pub trait ArgvView: Index<usize, Output = [u8]> {
// Required methods
fn len(&self) -> usize;
fn get(&self, i: usize) -> Option<&[u8]>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn first(&self) -> Option<&[u8]> { ... }
fn iter(&self) -> ArgvIter<'_, Self>
where Self: Sized { ... }
fn copy_into(&self, out: &mut Argv) { ... }
fn to_argv(&self) -> Argv { ... }
}Expand description
Read-only view over a parsed command’s argument vector.
Implemented by both Argv (owned) and ArgvBorrowed (zero-copy). The
command runtime takes argvs as &impl ArgvView, so the local fast path
can hand a borrowed argv straight to dispatch with no memcpy.
Required Methods§
Provided Methods§
Sourcefn copy_into(&self, out: &mut Argv)
fn copy_into(&self, out: &mut Argv)
Clear out and refill it with this view’s arguments. out keeps
its buffer capacity across the clear, so refilling a recycled
Argv (see crate::ArgvPool) is allocation-free in steady
state. Object-safe (no Self: Sized bound).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".