Struct dyer::affix::AffixBuilder[][src]

pub struct AffixBuilder { /* fields omitted */ }
Expand description

Serve as an media to create an instance of Affix

This type can be used to construct an instance or Affix through a builder-like pattern.

Implementations

Create an instance of AffixBuilder that used to build a Affix
Same as Affix::builder()

Examples
let affix = AffixBuilder::new()
    .body(());

get shared reference to header of AffixBuilder Same as Affix::headers(...)

Examples
let affix = AffixBuilder::new()
    .header("accept", "*/*")    
    .body(());
assert_eq!(affix.header_ref()["accept"], "*/*");

get mutable reference to header of AffixBuilder

Examples
let affix = AffixBuilder::new()
    .header("accept", "*/*")    
    .body(());
affix.header_mut().insert("accept", "text/html");
assert_eq!(affix.header_ref()["accept"], "text/html");

set the headers of Affix

Examples
let affix = AffixBuilder::new()
    .header("accept", "*/*")
    .body(());
assert_eq!(affix.header_ref()["accept"], "*/*");

get shared reference to meta extensions of Affix

Examples
struct S {}
let affix = AffixBuilder::new()
    .body(());
assert!(affix.extensions().get::<S>().is_none());

get mutable reference to extensions of Affix

Examples
struct S {}
let affix = Affix::builder()
    .body(());
let s = S {};
affix.extensions_mut().insert(s);
assert_eq!(affix.extensions().get::<S>(), Some(&s));

set the extensions of Affix

Examples
let affix = AffixBuilder::new()
    .extensions(vec![1,2,3])
    .body(());
assert_eq!(affix.extensions_ref(), &vec![1,2,3]);

get shared reference to exts of AffixBuilder Same as Affix::exts(...)

Examples
struct S {}
let affix = AffixBuilder::new()
    .parser(parser_fn)
    .body(());
let s = S {};
affix.exts_mut.insert(s);
assert_eq!(affix.exts_ref().get::<S>(), &s);

get mutable reference to exts of AffixBuilder

Examples
let affix = AffixBuilder::new()
    .body(());
affix.exts_mut().insert(vec![1,2,3]);
assert_eq!(affix.exts_ref().get::<Vec<_>>(), vec![1,2,3]);

set the exts of Affix

Examples
let Affix = AffixBuilder::new()
    .exts(vec![1,2,3])
    .body(());
assert_eq!(Affix.exts_ref(), &vec![1,2,3]);

get shared reference to info of Affix same as Affix::info(...)

Examples
let affix = Affix::builder()
    .body(());
assert_eq!(affix.info_ref().unique, true);

get mutable reference to info of Affix same as Affix::info_mut(...)

Examples
let info = Info::default();
info.unique = false;
let affix = Affix::builder()
    .body(());
affix.info_mut() = info;
assert_eq!(affix.info_ref().unique, false);

set the info of Affix

Examples
let affix = affixBuilder::new()
    .body(());
assert_eq!(affix.info_ref().unique, true);

Take this AffixBuilder and combine the body to create a Affix

Examples
let _ = AffixBuilder::new()
    .body(());

get shared reference to meta of Affix,

Examples
let affix = Affix::builder()    
    .body(());
assert_eq!(affix.meta_ref().rank, 0);

set the meta of Affix

Examples
let meta = MetaAffix::new();
let affix = AffixBuilder::new()
    .meta(meta)    
    .body(());

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more