Skip to main content

CombinedList

Struct CombinedList 

Source
pub struct CombinedList<'a, I> { /* private fields */ }
Expand description

Several validated field lines read as one list.

§Examples

use parse_net::{list, Limits};

let lines: [&[u8]; 2] = [b"gzip", b"br, zstd"];
let c = list::combined(lines, &Limits::DEFAULT)?;
assert_eq!(c.len(), 3);
assert!(c.iter().any(|e| e == b"zstd"));

Implementations§

Source§

impl<'a, I: Iterator<Item = &'a [u8]> + Clone> CombinedList<'a, I>

Source

pub fn iter(&self) -> CombinedElements<'a, I> ⓘ

The elements of every line, in order.

§Examples
use parse_net::{list, Limits};

let lines: [&[u8]; 2] = [b"gzip", b"br, zstd"];
let c = list::combined(lines, &Limits::DEFAULT)?;
assert_eq!(c.iter().collect::<Vec<_>>(), [&b"gzip"[..], b"br", b"zstd"]);
Source

pub const fn len(&self) -> usize

The number of elements across all lines.

§Examples
use parse_net::{list, Limits};

let lines: [&[u8]; 3] = [b"a, b", b"", b"c"];
assert_eq!(list::combined(lines, &Limits::DEFAULT)?.len(), 3);
Source

pub const fn is_empty(&self) -> bool

Whether no line has an element.

§Examples
use parse_net::{list, Limits};

let lines: [&[u8]; 2] = [b"", b" , "];
assert!(list::combined(lines, &Limits::DEFAULT)?.is_empty());

Trait Implementations§

Source§

impl<'a, I: Clone> Clone for CombinedList<'a, I>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, I: Debug> Debug for CombinedList<'a, I>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, I> Freeze for CombinedList<'a, I>
where I: Freeze,

§

impl<'a, I> RefUnwindSafe for CombinedList<'a, I>
where I: RefUnwindSafe,

§

impl<'a, I> Send for CombinedList<'a, I>
where I: Send,

§

impl<'a, I> Sync for CombinedList<'a, I>
where I: Sync,

§

impl<'a, I> Unpin for CombinedList<'a, I>
where I: Unpin,

§

impl<'a, I> UnsafeUnpin for CombinedList<'a, I>
where I: UnsafeUnpin,

§

impl<'a, I> UnwindSafe for CombinedList<'a, I>
where I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.