Enum zenv::Line[][src]

pub enum Line<'l> {
    KeyVal(KeyVal<'l>),
    Empty,
}
Expand description

(Can be) Used to parse the current line

Example

use zenv::{Line, KeyVal, Quote};

let line = Line::from("BASIC=basic");

let k = "BASIC";
let v = "basic".to_string();
assert_eq!(line, Line::KeyVal(KeyVal { k, v, q: Quote::No }));

// Commented line
let empty = Line::from("# COMMENT=commented");

assert_eq!(empty, Line::Empty);

// With quotes
let quoted = Line::from("S_QUOTED='single_quoted'");

let k = "S_QUOTED";
let v = "single_quoted".to_string();
assert_eq!(quoted, Line::KeyVal(KeyVal { k, v, q: Quote::Single }));

Variants

KeyVal(KeyVal<'l>)

Tuple Fields

0: KeyVal<'l>

When the current line is a key=val pair

Empty

When the current line is empty

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.