Section

Enum Section 

Source
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

The global section of a config.

Fields

§comment: Option<&'input str>

Comment on the same line as the section header

§lines: Vec<Line<'input>>

Lines in this section.

§

Default

The lines in the default section of a config.

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.

§

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> From<&'a Section<'a>> for Section

Source§

fn from(section: &'a Section<'a>) -> Self

Converts to this type from the input type.
Source§

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

Source§

type Error = Error

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)

Source§

type Error = Error

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)

Source§

type Error = Error

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)

Source§

type Error = Error

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> Freeze for Section<'input>

§

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 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

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.