Struct c2rust_ast_builder::Builder
source · [−]pub struct Builder { /* private fields */ }Implementations
sourceimpl 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<P: Make<GenericParam>>(self, param: P) -> Self
pub fn prepare_meta_namevalue(&self, mnv: MetaNameValue) -> PreparedMetaItem
pub fn prepare_meta_list(&self, list: MetaList) -> PreparedMetaItem
pub fn prepare_meta_path<I>(&self, path: I) -> PreparedMetaItem where
I: Make<Path>,
pub fn prepare_meta<K>(&self, kind: K) -> PreparedMetaItem where
K: Make<Meta>,
pub fn prepare_nested_meta_item<I, K>(
&self,
path: I,
kind: K
) -> PreparedMetaItem where
I: Make<Path>,
K: Make<Meta>,
pub fn prepared_attr(self, prepared: PreparedMetaItem) -> Self
pub fn str_attr<K, V>(self, key: K, value: V) -> Self where
K: Make<Path>,
V: Make<Lit>,
pub fn single_attr<K>(self, key: K) -> Self where
K: Make<PathSegment>,
pub fn call_attr<K, V>(self, func: K, arguments: Vec<V>) -> Self where
K: Make<PathSegment>,
V: Make<Ident>,
pub fn path_segment_with_args<I, P>(self, identifier: I, args: P) -> PathSegment where
I: Make<Ident>,
P: Make<PathArguments>,
pub fn parenthesized_args<Ts>(self, tys: Ts) -> ParenthesizedGenericArguments where
Ts: Make<Vec<Box<Type>>>,
pub fn angle_bracketed_args<A>(
self,
args: Vec<A>
) -> AngleBracketedGenericArguments where
A: Make<GenericArgument>,
pub fn generic_arg<A>(self, arg: A) -> GenericArgument where
A: Make<GenericArgument>,
pub fn ident<I>(self, name: I) -> Ident where
I: Make<Ident>,
pub fn path_segment<S>(self, seg: S) -> PathSegment where
S: Make<PathSegment>,
pub fn path<Pa>(self, path: Pa) -> Path where
Pa: Make<Path>,
pub fn use_tree<Pa, K>(self, prefix: Pa, kind: K) -> UseTree where
Pa: Make<Path>,
K: Make<UseTree>,
pub fn abs_path<Pa>(self, path: Pa) -> Path where
Pa: Make<Path>,
pub fn array_expr<A>(self, args: Vec<A>) -> Box<Expr> where
A: Make<Box<Expr>>,
pub fn call_expr<F, A>(self, func: F, args: Vec<A>) -> Box<Expr> where
F: Make<Box<Expr>>,
A: Make<Box<Expr>>,
pub fn method_call_expr<E, S, A>(
self,
expr: E,
seg: S,
args: Vec<A>
) -> Box<Expr> where
E: Make<Box<Expr>>,
S: Make<PathSegment>,
A: Make<Box<Expr>>,
pub fn tuple_expr<E>(self, exprs: Vec<E>) -> Box<Expr> where
E: Make<Box<Expr>>,
pub fn binary_expr<O, E>(self, op: O, lhs: E, rhs: E) -> Box<Expr> where
O: Make<BinOp>,
E: Make<Box<Expr>>,
pub fn unary_expr<O, E>(self, op: O, a: E) -> Box<Expr> where
O: Make<UnOp>,
E: Make<Box<Expr>>,
pub fn lit_expr<L>(self, lit: L) -> Box<Expr> where
L: Make<Lit>,
pub fn cast_expr<E, T>(self, e: E, t: T) -> Box<Expr> where
E: Make<Box<Expr>>,
T: Make<Box<Type>>,
pub fn type_expr<E, T>(self, e: E, t: T) -> Box<Expr> where
E: Make<Box<Expr>>,
T: Make<Box<Type>>,
pub fn unsafe_block_expr<B>(self, unsafe_blk: B) -> Box<Expr> where
B: Make<ExprUnsafe>,
pub fn block_expr<B>(self, blk: B) -> Box<Expr> where
B: Make<Box<Block>>,
pub fn labelled_block_expr<B, L>(self, blk: B, lbl: L) -> Box<Expr> where
B: Make<Box<Block>>,
L: Make<Label>,
pub fn assign_expr<E1, E2>(self, lhs: E1, rhs: E2) -> Box<Expr> where
E1: Make<Box<Expr>>,
E2: Make<Box<Expr>>,
pub fn assign_op_expr<O, E1, E2>(self, op: O, lhs: E1, rhs: E2) -> Box<Expr> where
O: Make<BinOp>,
E1: Make<Box<Expr>>,
E2: Make<Box<Expr>>,
pub fn index_expr<E1, E2>(self, lhs: E1, rhs: E2) -> Box<Expr> where
E1: Make<Box<Expr>>,
E2: Make<Box<Expr>>,
pub fn abs_path_expr<Pa>(self, path: Pa) -> Box<Expr> where
Pa: Make<Path>,
pub fn path_expr<Pa>(self, path: Pa) -> Box<Expr> where
Pa: Make<Path>,
pub fn qpath_expr<Pa>(self, qself: Option<QSelf>, path: Pa) -> Box<Expr> where
Pa: Make<Path>,
sourcepub fn repeat_expr<E, N>(self, expr: E, n: N) -> Box<Expr> where
E: Make<Box<Expr>>,
N: Make<Box<Expr>>,
pub fn repeat_expr<E, N>(self, expr: E, n: N) -> Box<Expr> where
E: Make<Box<Expr>>,
N: Make<Box<Expr>>,
An array literal constructed from one repeated element.
[expr; n]
pub fn paren_expr<E>(self, e: E) -> Box<Expr> where
E: Make<Box<Expr>>,
pub fn ident_expr<I>(self, name: I) -> Box<Expr> where
I: Make<Ident>,
pub fn addr_of_expr<E>(self, e: E) -> Box<Expr> where
E: Make<Box<Expr>>,
pub fn mac_expr<M>(self, mac: M) -> Box<Expr> where
M: Make<Macro>,
pub fn struct_expr<Pa>(self, path: Pa, fields: Vec<FieldValue>) -> Box<Expr> where
Pa: Make<Path>,
pub fn struct_expr_base<Pa, E>(
self,
path: Pa,
fields: Vec<FieldValue>,
base: Option<E>
) -> Box<Expr> where
Pa: Make<Path>,
E: Make<Box<Expr>>,
pub fn field_expr<E, F>(self, val: E, field: F) -> Box<Expr> where
E: Make<Box<Expr>>,
F: Make<Ident>,
pub fn anon_field_expr<E>(self, val: E, field: u32) -> Box<Expr> where
E: Make<Box<Expr>>,
pub fn field<I, E>(self, ident: I, expr: E) -> FieldValue where
I: Make<Ident>,
E: Make<Box<Expr>>,
pub fn match_expr<E>(self, cond: E, arms: Vec<Arm>) -> Box<Expr> where
E: Make<Box<Expr>>,
pub fn arm<Pa, E>(self, pat: Pa, guard: Option<E>, body: E) -> Arm where
E: Make<Box<Expr>>,
Pa: Make<Box<Pat>>,
pub fn int_lit<T>(self, i: u128, ty: T) -> Lit where
T: LitStringable,
pub fn int_unsuffixed_lit(self, i: u128) -> Lit
pub fn float_lit<T>(self, s: &str, ty: T) -> Lit where
T: LitStringable,
pub fn float_unsuffixed_lit(self, s: &str) -> Lit
pub fn bool_lit(self, b: bool) -> Lit
pub fn ifte_expr<C, T, E>(
self,
cond: C,
then_case: T,
else_case: Option<E>
) -> Box<Expr> where
C: Make<Box<Expr>>,
T: Make<Box<Block>>,
E: Make<Box<Expr>>,
pub fn while_expr<C, B, I>(
self,
cond: C,
body: B,
label: Option<I>
) -> Box<Expr> where
C: Make<Box<Expr>>,
B: Make<Box<Block>>,
I: Make<Ident>,
pub fn loop_expr<B, I>(self, body: B, label: Option<I>) -> Box<Expr> where
B: Make<Box<Block>>,
I: Make<Ident>,
pub fn for_expr<Pa, E, B, I>(
self,
pat: Pa,
expr: E,
body: B,
label: Option<I>
) -> Box<Expr> where
Pa: Make<Box<Pat>>,
E: Make<Box<Expr>>,
B: Make<Box<Block>>,
I: Make<Ident>,
pub fn ident_pat<I>(self, name: I) -> Box<Pat> where
I: Make<Ident>,
pub fn tuple_pat<Pa>(self, pats: Vec<Pa>) -> Box<Pat> where
Pa: Make<Box<Pat>>,
pub fn qpath_pat<Pa>(self, qself: Option<QSelf>, path: Pa) -> Box<Pat> where
Pa: Make<Path>,
pub fn wild_pat(self) -> Box<Pat>
pub fn lit_pat<L>(self, lit: L) -> Box<Pat> where
L: Make<Box<Expr>>,
pub fn mac_pat<M>(self, mac: M) -> Box<Pat> where
M: Make<Macro>,
pub fn ident_ref_pat<I>(self, name: I) -> Box<Pat> where
I: Make<Ident>,
pub fn or_pat<Pa>(self, pats: Vec<Pa>) -> Box<Pat> where
Pa: Make<Box<Pat>>,
pub fn barefn_ty<T>(self, decl: T) -> Box<Type> where
T: Make<Box<(Vec<BareFnArg>, Option<Variadic>, ReturnType)>>,
pub fn array_ty<T, E>(self, ty: T, len: E) -> Box<Type> where
T: Make<Box<Type>>,
E: Make<Box<Expr>>,
pub fn slice_ty<T>(self, ty: T) -> Box<Type> where
T: Make<Box<Type>>,
pub fn ptr_ty<T>(self, ty: T) -> Box<Type> where
T: Make<Box<Type>>,
pub fn ref_ty<T>(self, ty: T) -> Box<Type> where
T: Make<Box<Type>>,
pub fn ref_lt_ty<L, T>(self, lt: L, ty: T) -> Box<Type> where
L: Make<Lifetime>,
T: Make<Box<Type>>,
pub fn never_ty(self) -> Box<Type>
pub fn tuple_ty<T>(self, elem_tys: Vec<T>) -> Box<Type> where
T: Make<Box<Type>>,
pub fn path_ty<Pa>(self, path: Pa) -> Box<Type> where
Pa: Make<Path>,
pub fn qpath_ty<Pa>(self, qself: Option<QSelf>, path: Pa) -> Box<Type> where
Pa: Make<Path>,
pub fn ident_ty<I>(self, name: I) -> Box<Type> where
I: Make<Ident>,
pub fn infer_ty(self) -> Box<Type>
pub fn mac_ty<M>(self, mac: M) -> Box<Type> where
M: Make<Macro>,
pub fn cvar_args_ty(self) -> Box<Type>
pub fn local_stmt<L>(self, local: L) -> Stmt where
L: Make<Box<Local>>,
pub fn expr_stmt<E>(self, expr: E) -> Stmt where
E: Make<Box<Expr>>,
pub fn semi_stmt<E>(self, expr: E) -> Stmt where
E: Make<Box<Expr>>,
pub fn item_stmt<I>(self, item: I) -> Stmt where
I: Make<Box<Item>>,
pub fn mac_stmt<M>(self, mac: M) -> Stmt where
M: Make<Macro>,
pub fn static_item<I, T, E>(self, name: I, ty: T, init: E) -> Box<Item> where
I: Make<Ident>,
T: Make<Box<Type>>,
E: Make<Box<Expr>>,
pub fn const_item<I, T, E>(self, name: I, ty: T, init: E) -> Box<Item> where
I: Make<Ident>,
T: Make<Box<Type>>,
E: Make<Box<Expr>>,
pub fn fn_item<S, B>(self, sig: S, block: B) -> Box<Item> where
S: Make<Signature>,
B: Make<Box<Block>>,
pub fn variadic_arg(self, variadic_attrs: Vec<Attribute>) -> Variadic
pub fn fn_decl<I>(
self,
name: I,
inputs: Vec<FnArg>,
variadic: Option<Variadic>,
output: ReturnType
) -> Box<(Ident, Vec<FnArg>, Option<Variadic>, ReturnType)> where
I: Make<Ident>,
pub fn struct_item<I>(
self,
name: I,
fields: Vec<Field>,
is_tuple: bool
) -> Box<Item> where
I: Make<Ident>,
pub fn union_item<I>(self, name: I, fields: Vec<Field>) -> Box<Item> where
I: Make<Ident>,
pub fn enum_item<I>(self, name: I, fields: Vec<Variant>) -> Box<Item> where
I: Make<Ident>,
pub fn type_item<I, T>(self, name: I, ty: T) -> Box<Item> where
I: Make<Ident>,
T: Make<Box<Type>>,
pub fn mod_item<I>(self, name: I, items: Option<Vec<Item>>) -> Box<Item> where
I: Make<Ident>,
pub fn mod_<I>(self, items: Vec<I>) -> Vec<Item> where
I: Make<Box<Item>>,
pub fn mac_item<M>(self, mac: M) -> Box<Item> where
M: Make<Macro>,
pub fn variant<I>(self, name: I, fields: Fields) -> Variant where
I: Make<Ident>,
pub fn unit_variant<I, E>(self, name: I, disc: Option<E>) -> Variant where
I: Make<Ident>,
E: Make<Box<Expr>>,
pub fn impl_item<T>(self, ty: T, items: Vec<ImplItem>) -> Box<Item> where
T: Make<Box<Type>>,
pub fn extern_crate_item<I>(self, name: I, rename: Option<I>) -> Box<Item> where
I: Make<Ident>,
pub fn use_item<U>(self, tree: U) -> Box<Item> where
U: Make<UseTree>,
pub fn use_simple_item<Pa, I>(self, path: Pa, rename: Option<I>) -> Box<Item> where
Pa: Make<Path>,
I: Make<Ident>,
pub fn use_multiple_item<Pa, I, It>(self, path: Pa, inner: It) -> Box<Item> where
Pa: Make<Path>,
I: Make<Ident>,
It: Iterator<Item = I>,
pub fn use_glob_item<Pa>(self, path: Pa) -> Box<Item> where
Pa: Make<Path>,
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<M>(self, mac: M) -> ImplItem where
M: Make<Macro>,
pub fn mac_trait_item<M>(self, mac: M) -> TraitItem where
M: Make<Macro>,
pub fn fn_foreign_item<D>(self, decl: D) -> ForeignItem where
D: Make<Box<(Ident, Vec<FnArg>, Option<Variadic>, ReturnType)>>,
pub fn static_foreign_item<I, T>(self, name: I, ty: T) -> ForeignItem where
I: Make<Ident>,
T: Make<Box<Type>>,
pub fn ty_foreign_item<I>(self, name: I) -> ForeignItem where
I: Make<Ident>,
pub fn mac_foreign_item<M>(self, mac: M) -> ForeignItem where
M: Make<Macro>,
pub fn struct_field<I, T>(self, ident: I, ty: T) -> Field where
I: Make<Ident>,
T: Make<Box<Type>>,
pub fn enum_field<T>(self, ty: T) -> Field where
T: Make<Box<Type>>,
pub fn unsafe_block<S>(self, stmts: Vec<S>) -> ExprUnsafe where
S: Make<Stmt>,
pub fn block<S>(self, stmts: Vec<S>) -> Box<Block> where
S: Make<Stmt>,
pub fn label<L>(self, lbl: L) -> Label where
L: Make<Label>,
pub fn break_expr_value<L, E>(
self,
label: Option<L>,
value: Option<E>
) -> Box<Expr> where
L: Make<Label>,
E: Make<Box<Expr>>,
pub fn bare_arg<T, I>(self, ty: T, name: Option<I>) -> BareFnArg where
T: Make<Box<Type>>,
I: Make<Box<Ident>>,
pub fn arg<T, Pt>(self, ty: T, pat: Pt) -> FnArg where
T: Make<Box<Type>>,
Pt: Make<Box<Pat>>,
pub fn self_arg<S>(self, kind: S) -> FnArg where
S: Make<SelfKind>,
pub fn ty_param<I>(self, ident: I) -> GenericParam where
I: Make<Ident>,
pub fn ty<T>(self, kind: Type) -> Type
pub fn lt_param<L>(self, lifetime: L) -> GenericParam where
L: Make<Lifetime>,
pub fn lifetime<L: Make<Lifetime>>(self, lt: L) -> Lifetime
pub fn attribute<Pa, Ma>(
self,
style: AttrStyle,
path: Pa,
args: Ma
) -> Attribute where
Pa: Make<Path>,
Ma: Make<TokenStream>,
pub fn meta_item_attr(self, style: AttrStyle, meta_item: Meta) -> Self
pub fn meta_path<Pa>(self, path: Pa) -> Meta where
Pa: Make<Path>,
pub fn meta_list<I, N>(self, path: I, args: N) -> Meta where
I: Make<Path>,
N: Make<Vec<NestedMeta>>,
pub fn meta_namevalue<K, V>(self, key: K, value: V) -> Meta where
K: Make<Path>,
V: Make<Lit>,
pub fn nested_meta_item<K>(self, kind: K) -> NestedMeta where
K: Make<NestedMeta>,
pub fn as_inner_attrs(self) -> Vec<Attribute>
pub fn into_attrs(self) -> Vec<Attribute>
pub fn empty_mac<Pa>(self, path: Pa, delim: MacroDelimiter) -> Macro where
Pa: Make<Path>,
pub fn mac<Pa, Ts>(
self,
func: Pa,
arguments: Ts,
delim: MacroDelimiter
) -> Macro where
Pa: Make<Path>,
Ts: Make<TokenStream>,
sourcepub fn local<V, T, E>(self, pat: V, ty: Option<T>, init: Option<E>) -> Local where
V: Make<Box<Pat>>,
T: Make<Box<Type>>,
E: Make<Box<Expr>>,
pub fn local<V, T, E>(self, pat: V, ty: Option<T>, init: Option<E>) -> Local where
V: Make<Box<Pat>>,
T: Make<Box<Type>>,
E: Make<Box<Expr>>,
Create a local variable
pub fn return_expr<E>(self, val: Option<E>) -> Box<Expr> where
E: Make<Box<Expr>>,
pub fn continue_expr<I>(self, label: Option<I>) -> Box<Expr> where
I: Make<Ident>,
pub fn break_expr<I>(self, label: Option<I>) -> Box<Expr> where
I: Make<Ident>,
pub fn closure_expr<D, E>(
self,
capture: CaptureBy,
mov: Movability,
decl: D,
body: E
) -> Box<Expr> where
D: Make<Box<(Ident, Vec<FnArg>, Option<Variadic>, ReturnType)>>,
E: Make<Box<Expr>>,
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl !Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more