[][src]Struct uclicious::raw::parser::Parser

pub struct Parser { /* fields omitted */ }

Raw parser object.

Methods

impl Parser[src]

pub fn with_flags(flags: ParserFlags) -> Self[src]

Create a new parser with given option flags.

pub fn add_chunk_full<C: AsRef<str>>(
    &mut self,
    chunk: C,
    priority: Priority,
    strategy: DuplicateStrategy
) -> Result<(), UclError>
[src]

Add a chunk of text to the parser. String must:

  • not have \0 character;
  • must be valid UCL object;

pub fn add_file_full<F: AsRef<Path>>(
    &mut self,
    file: F,
    priority: Priority,
    strategy: DuplicateStrategy
) -> Result<(), UclError>
[src]

Add a file by a file path to the parser. This function uses mmap call to load file, therefore, it should not be shrunk during parsing.

pub fn add_fd_full<F: AsRawFd>(
    &mut self,
    fd: F,
    priority: Priority,
    strategy: DuplicateStrategy
) -> Result<(), UclError>
[src]

pub fn set_filevars<F: AsRef<Path>>(
    &mut self,
    filename: F,
    need_expand: bool
) -> Result<(), UclError>
[src]

Add the standard file variables to the parser based on the filename specified:

  • $FILENAME- a filename of ucl input
  • $CURDIR - a current directory of the input

For example, if a filename param is ../something.conf then the variables will have the following values:

  • $FILENAME - ../something.conf
  • $CURDIR - ..

if need_expand parameter is true then all relative paths are expanded using realpath call. In this example if .. is /etc/dir then variables will have these values:

  • $FILENAME - /etc/something.conf
  • $CURDIR - /etc

pub fn get_object(&mut self) -> Result<Object, UclError>[src]

Get a top object for a parser.

pub fn register_variable<K: AsRef<str>, V: AsRef<str>>(
    &mut self,
    var: K,
    value: V
) -> &mut Self
[src]

Register new variable $var that should be replaced by the parser to the value string. Variables need to be registered before they are referenced.

Panics

This function panics if either var or value has \0.

Trait Implementations

impl Debug for Parser[src]

impl Default for Parser[src]

impl Drop for Parser[src]

Auto Trait Implementations

impl RefUnwindSafe for Parser

impl !Send for Parser

impl !Sync for Parser

impl Unpin for Parser

impl UnwindSafe for Parser

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: FromObject<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.