pub enum Section<'input> {
    BlankLine,
    Comment(&'input str),
    Global {
        comment: Option<&'input str>,
        lines: Vec<Line<'input>>,
    },
    Default {
        comment: Option<&'input str>,
        proxy: Option<&'input str>,
        lines: Vec<Line<'input>>,
    },
    Frontend {
        comment: Option<&'input str>,
        proxy: &'input str,
        lines: Vec<Line<'input>>,
        header_addr: Option<(AddressRef<'input>, Option<&'input str>)>,
    },
    Listen {
        comment: Option<&'input str>,
        proxy: &'input str,
        lines: Vec<Line<'input>>,
        header_addr: Option<(AddressRef<'input>, Option<&'input str>)>,
    },
    Backend {
        comment: Option<&'input str>,
        proxy: &'input str,
        lines: Vec<Line<'input>>,
    },
    Userlist {
        comment: Option<&'input str>,
        name: &'input str,
        lines: Vec<Line<'input>>,
    },
    UnknownLine {
        line: &'input str,
    },
}
Expand description

Parsed haproxy config preserving the order and comments. Does not support conditional blocks, these and other unsupported lines will be stored in the UnknownLine variant. Information outside the header is containd in the correct order in the lines member. See the Line documentation.

Variants§

§

BlankLine

§

Comment(&'input str)

Comment on a seperate line not in a section

§

Global

Fields

§comment: Option<&'input str>

Comment on the same line as the section header

§lines: Vec<Line<'input>>

Lines in this section.

The global section of a config.

§

Default

Fields

§comment: Option<&'input str>

Comment on the same line as the section header

§proxy: Option<&'input str>

The default proxy stated after the section header

§lines: Vec<Line<'input>>

Lines in this section.

The lines in the default section of a config.

§

Frontend

Fields

§comment: Option<&'input str>

Comment on the same line as the section header

§proxy: &'input str

The proxy stated after the section header

§lines: Vec<Line<'input>>

Lines in this section.

§header_addr: Option<(AddressRef<'input>, Option<&'input str>)>

Optional address to which the frontend binds can be stated in the header, for example frontend webserver *:80 instead of a bind line, any optional config for the bind follows

§

Listen

Fields

§comment: Option<&'input str>

Comment on the same line as the section header

§proxy: &'input str

The proxy stated after the section header

§lines: Vec<Line<'input>>

Lines in this section.

§header_addr: Option<(AddressRef<'input>, Option<&'input str>)>

Optional address to which the listen binds can be stated in the header, for example frontend webserver *:80 instead of a bind line, any optional config for the bind follows

§

Backend

Fields

§comment: Option<&'input str>

Comment on the same line as the section header

§proxy: &'input str

The proxy stated after the section header

§lines: Vec<Line<'input>>

Lines in this section.

§

Userlist

Fields

§comment: Option<&'input str>

Comment on the same line as the section header

§name: &'input str

Name of this userlist

§lines: Vec<Line<'input>>

Lines in this section.

§

UnknownLine

Fields

§line: &'input str

A line that could not be parsed.

Trait Implementations§

source§

impl<'input> Debug for Section<'input>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> TryFrom<&'a Section<'a>> for (Name, Backend)

§

type Error = Error<'a>

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

fn try_from(entry: &'a Section<'a>) -> Result<(Name, Backend), Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Section<'a>> for (Name, Frontend)

§

type Error = Error<'a>

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

fn try_from(entry: &'a Section<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Section<'a>> for (Name, Listen)

§

type Error = Error<'a>

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

fn try_from(entry: &'a Section<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Section<'a>> for (Name, Userlist)

§

type Error = Error<'a>

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

fn try_from(entry: &'a Section<'a>) -> Result<(Name, Userlist), Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'input> RefUnwindSafe for Section<'input>

§

impl<'input> Send for Section<'input>

§

impl<'input> Sync for Section<'input>

§

impl<'input> Unpin for Section<'input>

§

impl<'input> UnwindSafe for Section<'input>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.