pub struct Builder { /* private fields */ }Implementations§
Source§impl Builder
impl Builder
pub fn new() -> Builder
pub fn vis<V: Make<Visibility>>(self, vis: V) -> Self
pub fn pub_(self) -> Self
pub fn set_mutbl<M: Make<Mutability>>(self, mutbl: M) -> Self
pub fn mutbl(self) -> Self
pub fn unsafety<U: Make<Unsafety>>(self, unsafety: U) -> Self
pub fn unsafe_(self) -> Self
pub fn constness<C: Make<Constness>>(self, constness: C) -> Self
pub fn const_(self) -> Self
pub fn extern_<A: Make<Extern>>(self, ext: A) -> Self
pub fn span<S: Make<Span>>(self, span: S) -> Self
pub fn generic_over(self, param: GenericParam) -> Self
pub fn prepared_attr(self, meta: Meta) -> Self
pub fn str_attr<K, V>(self, key: K, value: V) -> Self
pub fn single_attr<K>(self, key: K) -> Self
pub fn call_attr<K, V>(self, func: K, arguments: V) -> Self
pub fn path_segment_with_args<I, P>(self, identifier: I, args: P) -> PathSegment
pub fn angle_bracketed_args<A>(
self,
args: Vec<A>,
) -> AngleBracketedGenericArgumentswhere
A: Make<GenericArgument>,
pub fn generic_arg<A>(self, arg: A) -> GenericArgumentwhere
A: Make<GenericArgument>,
pub fn ident<I>(self, name: I) -> Ident
pub fn path_segment<S>(self, seg: S) -> PathSegmentwhere
S: Make<PathSegment>,
pub fn path<Pa>(self, path: Pa) -> Path
pub fn use_tree<Pa>(self, prefix: Pa, tree: UseTree) -> UseTree
pub fn abs_path<Pa>(self, path: Pa) -> Path
pub fn array_expr(self, args: Vec<Box<Expr>>) -> Box<Expr>
pub fn call_expr(self, func: Box<Expr>, args: Vec<Box<Expr>>) -> Box<Expr>
pub fn method_call_expr<S>(
self,
expr: Box<Expr>,
seg: S,
args: Vec<Box<Expr>>,
) -> Box<Expr>where
S: Make<PathSegment>,
pub fn tuple_expr(self, exprs: Vec<Box<Expr>>) -> Box<Expr>
pub fn binary_expr(self, op: BinOp, lhs: Box<Expr>, rhs: Box<Expr>) -> Box<Expr>
pub fn unary_expr<O>(self, op: O, a: Box<Expr>) -> Box<Expr>
pub fn lit_expr<L>(self, lit: L) -> Box<Expr>
pub fn cast_expr(self, e: Box<Expr>, t: Box<Type>) -> Box<Expr>
pub fn unsafe_block_expr(self, unsafe_blk: ExprUnsafe) -> Box<Expr>
pub fn block_expr(self, block: Block) -> Box<Expr>
pub fn labelled_block_expr<L>(self, block: Block, lbl: L) -> Box<Expr>
pub fn assign_expr(self, lhs: Box<Expr>, rhs: Box<Expr>) -> Box<Expr>
pub fn assign_op_expr( self, op: BinOp, lhs: Box<Expr>, rhs: Box<Expr>, ) -> Box<Expr>
pub fn index_expr(self, lhs: Box<Expr>, rhs: Box<Expr>) -> Box<Expr>
pub fn abs_path_expr<Pa>(self, path: Pa) -> Box<Expr>
pub fn path_expr<Pa>(self, path: Pa) -> Box<Expr>
pub fn qpath_expr<Pa>(self, qself: Option<QSelf>, path: Pa) -> Box<Expr>
Sourcepub fn repeat_expr(self, expr: Box<Expr>, n: Box<Expr>) -> Box<Expr>
pub fn repeat_expr(self, expr: Box<Expr>, n: Box<Expr>) -> Box<Expr>
An array literal constructed from one repeated element.
[expr; n]
pub fn paren_expr(self, e: Box<Expr>) -> Box<Expr>
pub fn ident_expr<I>(self, name: I) -> Box<Expr>
pub fn addr_of_expr(self, e: Box<Expr>) -> Box<Expr>
pub fn mac_expr(self, mac: Macro) -> Box<Expr>
pub fn struct_expr<Pa>(self, path: Pa, fields: Vec<FieldValue>) -> Box<Expr>
pub fn struct_expr_base<Pa>( self, path: Pa, fields: Vec<FieldValue>, base: Option<Box<Expr>>, ) -> Box<Expr>
pub fn field_expr<F>(self, val: Box<Expr>, field: F) -> Box<Expr>
pub fn anon_field_expr(self, val: Box<Expr>, field: u32) -> Box<Expr>
pub fn field<I>(self, ident: I, expr: Box<Expr>) -> FieldValue
pub fn match_expr(self, cond: Box<Expr>, arms: Vec<Arm>) -> Box<Expr>
pub fn arm(self, pat: Pat, guard: Option<Box<Expr>>, body: Box<Expr>) -> Arm
pub fn int_lit(self, i: u128, ty: &str) -> Lit
pub fn int_unsuffixed_lit<S>(self, s: S) -> Lit
pub fn float_lit(self, s: &str, ty: &str) -> Lit
pub fn float_unsuffixed_lit(self, s: &str) -> Lit
pub fn bool_lit(self, b: bool) -> Lit
pub fn str_lit(self, s: &str) -> Lit
pub fn ifte_expr( self, cond: Box<Expr>, then_branch: Block, else_branch: Option<Box<Expr>>, ) -> Box<Expr>
pub fn while_expr<I>( self, cond: Box<Expr>, body: Block, label: Option<I>, ) -> Box<Expr>
pub fn loop_expr<I>(self, body: Block, label: Option<I>) -> Box<Expr>
pub fn for_expr<I>( self, pat: Pat, expr: Box<Expr>, body: Block, label: Option<I>, ) -> Box<Expr>
pub fn ident_pat<I>(self, name: I) -> Pat
pub fn tuple_pat(self, pats: Vec<Pat>) -> Pat
pub fn qpath_pat<Pa>(self, qself: Option<QSelf>, path: Pa) -> Box<Pat>
pub fn wild_pat(self) -> Pat
pub fn lit_pat(self, lit: Lit) -> Pat
pub fn path_pat(self, path: Path, qself: Option<QSelf>) -> Pat
pub fn mac_pat(self, mac: Macro) -> Pat
pub fn ident_ref_pat<I>(self, name: I) -> Pat
pub fn or_pat(self, pats: Vec<Pat>) -> Pat
pub fn barefn_ty( self, decl: (Vec<BareFnArg>, Option<BareVariadic>, ReturnType), ) -> Box<Type>
pub fn array_ty(self, ty: Box<Type>, len: Box<Expr>) -> Box<Type>
pub fn slice_ty(self, ty: Box<Type>) -> Box<Type>
pub fn ptr_ty(self, ty: Box<Type>) -> Box<Type>
pub fn ref_ty(self, ty: Box<Type>) -> Box<Type>
pub fn ref_lt_ty<L>(self, lt: L, ty: Box<Type>) -> Box<Type>
pub fn never_ty(self) -> Box<Type>
pub fn tuple_ty(self, elem_tys: Vec<Box<Type>>) -> Box<Type>
pub fn path_ty<Pa>(self, path: Pa) -> Box<Type>
pub fn qpath_ty<Pa>(self, qself: Option<QSelf>, path: Pa) -> Box<Type>
pub fn ident_ty<I>(self, name: I) -> Box<Type>
pub fn infer_ty(self) -> Box<Type>
pub fn mac_ty(self, mac: Macro) -> Box<Type>
pub fn local_stmt(self, local: Box<Local>) -> Stmt
pub fn expr_stmt(self, expr: Box<Expr>) -> Stmt
pub fn semi_stmt(self, expr: Box<Expr>) -> Stmt
pub fn item_stmt(self, item: Box<Item>) -> Stmt
pub fn mac_stmt(self, mac: Macro) -> Stmt
pub fn static_item<I>( self, name: I, ty: Box<Type>, init: Box<Expr>, ) -> Box<Item>
pub fn const_item<I>(self, name: I, ty: Box<Type>, init: Box<Expr>) -> Box<Item>
pub fn fn_item<S>(self, sig: S, block: Block) -> Box<Item>
pub fn variadic_arg(self, name: Option<String>) -> Variadic
pub fn bare_variadic_arg(self) -> BareVariadic
pub fn fn_decl<I>( self, name: I, inputs: Vec<FnArg>, variadic: Option<Variadic>, output: ReturnType, ) -> Box<(Ident, Vec<FnArg>, Option<Variadic>, ReturnType)>
pub fn struct_item<I>( self, name: I, fields: Vec<Field>, is_tuple: bool, ) -> Box<Item>
pub fn union_item<I>(self, name: I, fields: Vec<Field>) -> Box<Item>
pub fn enum_item<I>(self, name: I, fields: Vec<Variant>) -> Box<Item>
pub fn type_item<I>(self, name: I, ty: Box<Type>) -> Box<Item>
pub fn mod_item<I>(self, name: I, items: Option<Vec<Item>>) -> Box<Item>
pub fn mod_(self, items: Vec<Box<Item>>) -> Vec<Item>
pub fn mac_item(self, mac: Macro) -> Box<Item>
pub fn variant<I>(self, name: I, fields: Fields) -> Variant
pub fn unit_variant<I>(self, name: I, disc: Option<Box<Expr>>) -> Variant
pub fn impl_item(self, ty: Box<Type>, items: Vec<ImplItem>) -> Box<Item>
pub fn extern_crate_item<I>(self, name: I, rename: Option<I>) -> Box<Item>
pub fn use_item(self, tree: UseTree) -> Box<Item>
pub fn use_simple_item<Pa, I>(self, path: Pa, rename: Option<I>) -> Box<Item>
pub fn use_multiple_item<Pa, I, It>(self, path: Pa, inner: It) -> Box<Item>
pub fn use_glob_item<Pa>(self, path: Pa) -> Box<Item>
pub fn foreign_items(self, items: Vec<ForeignItem>) -> Box<Item>
pub fn get_abi(&self) -> Abi
pub fn get_abi_opt(&self) -> Option<Abi>
pub fn mac_impl_item(self, mac: Macro) -> ImplItem
pub fn mac_trait_item(self, mac: Macro) -> TraitItem
Sourcepub fn fn_foreign_item(
self,
decl: Box<(Ident, Vec<FnArg>, Option<Variadic>, ReturnType)>,
) -> Box<ForeignItem>
pub fn fn_foreign_item( self, decl: Box<(Ident, Vec<FnArg>, Option<Variadic>, ReturnType)>, ) -> Box<ForeignItem>
ForeignItem is large (472 bytes), so Box it.
Sourcepub fn static_foreign_item<I>(self, name: I, ty: Box<Type>) -> Box<ForeignItem>
pub fn static_foreign_item<I>(self, name: I, ty: Box<Type>) -> Box<ForeignItem>
ForeignItem is large (472 bytes), so Box it.
Sourcepub fn ty_foreign_item<I>(self, name: I) -> Box<ForeignItem>
pub fn ty_foreign_item<I>(self, name: I) -> Box<ForeignItem>
ForeignItem is large (472 bytes), so Box it.
pub fn mac_foreign_item(self, mac: Macro) -> ForeignItem
pub fn struct_field<I>(self, ident: I, ty: Box<Type>) -> Field
pub fn enum_field(self, ty: Box<Type>) -> Field
pub fn unsafe_block(self, stmts: Vec<Stmt>) -> ExprUnsafe
pub fn block(self, stmts: Vec<Stmt>) -> Block
pub fn label<L>(self, lbl: L) -> Label
pub fn break_expr_value<L>( self, label: Option<L>, value: Option<Box<Expr>>, ) -> Box<Expr>
pub fn bare_arg<I>(self, ty: Box<Type>, name: Option<I>) -> BareFnArg
pub fn arg(self, ty: Box<Type>, pat: Pat) -> FnArg
pub fn self_arg(self, kind: SelfKind) -> FnArg
pub fn ty_param<I>(self, ident: I) -> GenericParam
pub fn ty<T>(self, kind: Type) -> Type
pub fn lt_param<L>(self, lifetime: L) -> GenericParam
pub fn lifetime<L: Make<Lifetime>>(self, lt: L) -> Lifetime
pub fn attribute(self, style: AttrStyle, meta: Meta) -> Attribute
Sourcepub fn meta_list<I, N>(self, path: I, args: N) -> Meta
pub fn meta_list<I, N>(self, path: I, args: N) -> Meta
makes a meta item with the given path and some arguments
§Examples
mk().meta_list(“derive”, vec![“Clone”, “Copy”]) // -> derive(Clone, Copy)
Sourcepub fn meta_namevalue<K, V>(self, key: K, value: V) -> Meta
pub fn meta_namevalue<K, V>(self, key: K, value: V) -> Meta
makes a meta item with key value argument
§Examples
mk().meta_namevalue(“target_os”, “linux”) // -> target_os = "linux"
pub fn empty_mac<Pa>(self, path: Pa, delim: MacroDelimiter) -> Macro
pub fn mac<Ts>(self, func: Path, arguments: Ts, delim: MacroDelimiter) -> Macrowhere
Ts: Make<TokenStream>,
Sourcepub fn local(
self,
pat: Pat,
ty: Option<Box<Type>>,
init: Option<Box<Expr>>,
) -> Local
pub fn local( self, pat: Pat, ty: Option<Box<Type>>, init: Option<Box<Expr>>, ) -> Local
Create a local variable
pub fn return_expr(self, val: Option<Box<Expr>>) -> Box<Expr>
pub fn continue_expr<I>(self, label: Option<I>) -> Box<Expr>
pub fn break_expr<I>(self, label: Option<I>) -> Box<Expr>
pub fn closure_expr( self, capture: CaptureBy, mov: Movability, decl: (Ident, Vec<FnArg>, Option<Variadic>, ReturnType), body: Box<Expr>, ) -> Box<Expr>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl !Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more