Skip to main content

CodeGenContext

Struct CodeGenContext 

Source
pub struct CodeGenContext<'a> {
Show 142 fields pub type_mapper: &'a TypeMapper, pub annotation_aware_mapper: AnnotationAwareTypeMapper, pub string_optimizer: StringOptimizer, pub union_enum_generator: UnionEnumGenerator, pub generated_enums: Vec<TokenStream>, pub needs_hashmap: bool, pub needs_hashset: bool, pub needs_vecdeque: bool, pub needs_fnv_hashmap: bool, pub needs_ahash_hashmap: bool, pub needs_arc: bool, pub needs_rc: bool, pub needs_cow: bool, pub needs_rand: bool, pub needs_slice_random: bool, pub needs_rand_distr: bool, pub needs_serde_json: bool, pub needs_regex: bool, pub needs_chrono: bool, pub needs_tempfile: bool, pub needs_itertools: bool, pub needs_clap: bool, pub needs_csv: bool, pub needs_rust_decimal: bool, pub needs_num_rational: bool, pub needs_base64: bool, pub needs_md5: bool, pub needs_sha1: bool, pub needs_sha2: bool, pub needs_sha3: bool, pub needs_digest: bool, pub needs_blake2: bool, pub needs_hex: bool, pub needs_uuid: bool, pub needs_hmac: bool, pub needs_crc32: bool, pub needs_url_encoding: bool, pub needs_io_read: bool, pub needs_io_write: bool, pub needs_bufread: bool, pub needs_once_cell: bool, pub needs_lazy_lock: bool, pub needs_trueno: bool, pub numpy_vars: HashSet<String>, pub needs_tokio: bool, pub needs_glob: bool, pub needs_statrs: bool, pub needs_url: bool, pub declared_vars: Vec<HashSet<String>>, pub current_function_can_fail: bool, pub current_return_type: Option<Type>, pub module_mapper: ModuleMapper, pub imported_modules: HashMap<String, ModuleMapping>, pub imported_items: HashMap<String, String>, pub all_imported_modules: HashSet<String>, pub module_aliases: HashMap<String, String>, pub mutable_vars: HashSet<String>, pub needs_zerodivisionerror: bool, pub needs_indexerror: bool, pub needs_valueerror: bool, pub needs_argumenttypeerror: bool, pub needs_runtimeerror: bool, pub needs_filenotfounderror: bool, pub needs_syntaxerror: bool, pub needs_typeerror: bool, pub needs_keyerror: bool, pub needs_ioerror: bool, pub needs_attributeerror: bool, pub needs_stopiteration: bool, pub is_classmethod: bool, pub in_generator: bool, pub generator_state_vars: HashSet<String>, pub generator_iterator_state_vars: HashSet<String>, pub returns_impl_iterator: bool, pub var_types: HashMap<String, Type>, pub class_names: HashSet<String>, pub mutating_methods: HashMap<String, HashSet<String>>, pub property_methods: HashSet<String>, pub function_return_types: HashMap<String, Type>, pub function_param_borrows: HashMap<String, Vec<bool>>, pub function_param_muts: HashMap<String, Vec<bool>>, pub function_param_defaults: HashMap<String, Vec<Option<HirExpr>>>, pub class_field_defaults: HashMap<String, Vec<Option<HirExpr>>>, pub class_field_types: HashMap<String, Type>, pub class_method_return_types: HashMap<(String, String), Type>, pub tuple_iter_vars: HashSet<String>, pub iterator_vars: HashSet<String>, pub ref_params: HashSet<String>, pub mut_ref_params: HashSet<String>, pub is_final_statement: bool, pub result_bool_functions: HashSet<String>, pub result_returning_functions: HashSet<String>, pub option_returning_functions: HashSet<String>, pub current_error_type: Option<ErrorType>, pub exception_scopes: Vec<ExceptionScope>, pub argparser_tracker: ArgParserTracker, pub generated_args_struct: Option<TokenStream>, pub generated_commands_enum: Option<TokenStream>, pub current_subcommand_fields: Option<HashSet<String>>, pub validator_functions: HashSet<String>, pub in_json_context: bool, pub stdlib_mappings: StdlibMappings, pub hoisted_inference_vars: HashSet<String>, pub none_placeholder_vars: HashSet<String>, pub precomputed_option_fields: HashSet<String>, pub cse_subcommand_temps: HashMap<String, String>, pub nested_function_params: HashMap<String, Vec<HirParam>>, pub fn_str_params: HashSet<String>, pub in_cmd_handler: bool, pub cmd_handler_args_fields: Vec<String>, pub in_subcommand_match_arm: bool, pub boxed_dyn_write_vars: HashSet<String>, pub subcommand_match_fields: Vec<String>, pub hoisted_function_names: Vec<String>, pub is_main_function: bool, pub function_returns_boxed_write: bool, pub option_unwrap_map: HashMap<String, String>, pub narrowed_option_vars: HashSet<String>, pub needs_completed_process: bool, pub vararg_functions: HashSet<String>, pub slice_params: HashSet<String>, pub type_substitutions: HashMap<String, Type>, pub current_assign_type: Option<Type>, pub force_dict_value_option_wrap: bool, pub function_param_optionals: HashMap<String, Vec<bool>>, pub char_iter_vars: HashSet<String>, pub char_counter_vars: HashSet<String>, pub adt_child_to_parent: HashMap<String, String>, pub function_param_types: HashMap<String, Vec<Type>>, pub mut_option_dict_params: HashSet<String>, pub mut_option_params: HashSet<String>, pub needs_depyler_value_enum: bool, pub needs_python_string_ops: bool, pub needs_python_int_ops: bool, pub needs_depyler_date: bool, pub needs_depyler_datetime: bool, pub needs_depyler_timedelta: bool, pub needs_depyler_regex_match: bool, pub module_constant_types: HashMap<String, Type>, pub last_external_call_return_type: Option<String>, pub type_overrides: HashMap<String, Type>, pub vars_used_later: HashSet<String>,
}
Expand description

Code generation context

Maintains all state needed during Rust code generation including:

  • Type mapping and string optimization
  • Import tracking (needs_hashmap, needs_cow, etc.)
  • Variable scoping and mutability analysis
  • Generator state management

§Complexity

N/A (data structure)

Fields§

§type_mapper: &'a TypeMapper§annotation_aware_mapper: AnnotationAwareTypeMapper§string_optimizer: StringOptimizer§union_enum_generator: UnionEnumGenerator§generated_enums: Vec<TokenStream>§needs_hashmap: bool§needs_hashset: bool§needs_vecdeque: bool§needs_fnv_hashmap: bool§needs_ahash_hashmap: bool§needs_arc: bool§needs_rc: bool§needs_cow: bool§needs_rand: bool§needs_slice_random: bool§needs_rand_distr: bool§needs_serde_json: bool§needs_regex: bool§needs_chrono: bool§needs_tempfile: bool§needs_itertools: bool§needs_clap: bool§needs_csv: bool§needs_rust_decimal: bool§needs_num_rational: bool§needs_base64: bool§needs_md5: bool§needs_sha1: bool§needs_sha2: bool§needs_sha3: bool§needs_digest: bool§needs_blake2: bool§needs_hex: bool§needs_uuid: bool§needs_hmac: bool§needs_crc32: bool§needs_url_encoding: bool§needs_io_read: bool§needs_io_write: bool§needs_bufread: bool§needs_once_cell: bool§needs_lazy_lock: bool§needs_trueno: bool§numpy_vars: HashSet<String>§needs_tokio: bool§needs_glob: bool§needs_statrs: bool§needs_url: bool§declared_vars: Vec<HashSet<String>>§current_function_can_fail: bool§current_return_type: Option<Type>§module_mapper: ModuleMapper§imported_modules: HashMap<String, ModuleMapping>§imported_items: HashMap<String, String>§all_imported_modules: HashSet<String>

DEPYLER-1115: Track all imported module names (including external unmapped ones) Used to generate module::function() syntax for phantom binding compatibility

§module_aliases: HashMap<String, String>

DEPYLER-1136: Map module aliases to their original module paths For import xml.etree.ElementTree as ET: maps “ET” -> “xml.etree.ElementTree”

§mutable_vars: HashSet<String>§needs_zerodivisionerror: bool§needs_indexerror: bool§needs_valueerror: bool§needs_argumenttypeerror: bool§needs_runtimeerror: bool§needs_filenotfounderror: bool§needs_syntaxerror: bool§needs_typeerror: bool§needs_keyerror: bool§needs_ioerror: bool§needs_attributeerror: bool§needs_stopiteration: bool§is_classmethod: bool§in_generator: bool§generator_state_vars: HashSet<String>§generator_iterator_state_vars: HashSet<String>

DEPYLER-1082: Track generator state vars with Iterator/Generator type These need while let Some(x) = self.g.next() instead of for x in self.g because Box doesn’t implement IntoIterator

§returns_impl_iterator: bool

DEPYLER-1076: Track when function returns impl Iterator/IntoIterator When true, closures in iterator chains that capture local variables need move

§var_types: HashMap<String, Type>§class_names: HashSet<String>§mutating_methods: HashMap<String, HashSet<String>>§property_methods: HashSet<String>

DEPYLER-0737: Track property method names across all classes In Python, @property allows method access without (), but Rust requires () Used in convert_attribute to emit method call syntax for property access

§function_return_types: HashMap<String, Type>

DEPYLER-0269: Track function return types for Display trait selection Maps function name -> return type, populated during function generation Used to track types of variables assigned from function calls

§function_param_borrows: HashMap<String, Vec<bool>>

DEPYLER-0270: Track function parameter borrowing for auto-borrow decisions Maps function name -> Vec of booleans (true if param is borrowed, false if owned) Used to determine whether to add & when passing List/Dict/Set arguments

§function_param_muts: HashMap<String, Vec<bool>>

DEPYLER-0574: Track function parameters that need &mut (mutable borrow) Maps function name -> Vec of booleans (true if param is &mut, false if &) Used to determine whether to add &mut when passing arguments

§function_param_defaults: HashMap<String, Vec<Option<HirExpr>>>

DEPYLER-0621: Track function parameter default values Maps function name -> Vec of Option (None if no default, Some if has default) Used to supply default arguments at call sites when fewer args are passed

§class_field_defaults: HashMap<String, Vec<Option<HirExpr>>>

DEPYLER-0932: Track dataclass field default values Maps class name -> Vec of Option (None if no default, Some if has default) Used to supply default arguments at constructor call sites when fewer args are passed

§class_field_types: HashMap<String, Type>

DEPYLER-0720: Track class field types for self.field attribute access Maps field name -> Type, used to determine if self.X is float for int-to-float coercion

§class_method_return_types: HashMap<(String, String), Type>

DEPYLER-1007: Track class method return types for return type inference Maps (ClassName, MethodName) -> Type, used to infer types from method calls Example: (“Point”, “distance_squared”) -> Type::Int

§tuple_iter_vars: HashSet<String>

DEPYLER-0307 Fix #9: Track variables that iterate over tuples (from zip()) Used to generate tuple field access syntax (tuple.0, tuple.1) instead of vector indexing

§iterator_vars: HashSet<String>

DEPYLER-0520: Track variables assigned from iterator-producing expressions Used to avoid adding .iter().cloned() to variables that are already iterators

§ref_params: HashSet<String>

DEPYLER-0758: Track parameters passed by reference in current function Used to dereference reference params in arithmetic operations (e.g., date subtraction)

§mut_ref_params: HashSet<String>

DEPYLER-1217: Track parameters passed by mutable reference (&mut T) in current function Used to avoid double &mut when passing these params to other functions expecting &mut

§is_final_statement: bool

DEPYLER-0271: Tracks if current statement is the final statement in its block Used to generate idiomatic expression-based returns (no return keyword)

§result_bool_functions: HashSet<String>

DEPYLER-0308: Track functions that return Result<bool, E> Used to auto-unwrap in boolean contexts (if/while conditions)

§result_returning_functions: HashSet<String>

DEPYLER-0270: Track ALL functions that return Result<T, E> Used to auto-unwrap at call sites in non-Result functions

§option_returning_functions: HashSet<String>

DEPYLER-0497: Track functions that return Option Used to unwrap Options in format! macro and other contexts where Display is required

§current_error_type: Option<ErrorType>

DEPYLER-0310: Current function’s error type (for raise statement wrapping) None if function doesn’t return Result, Some(ErrorType) if it does

§exception_scopes: Vec<ExceptionScope>

DEPYLER-0333: Stack of exception scopes for try/except tracking Tracks whether code is inside try/except blocks to determine error handling strategy Empty stack = Unhandled scope (exceptions propagate to caller)

§argparser_tracker: ArgParserTracker

DEPYLER-0363: Track ArgumentParser patterns for clap transformation Accumulates ArgumentParser instances and add_argument calls to generate #[derive(Parser)] struct definitions

§generated_args_struct: Option<TokenStream>

DEPYLER-0424: Generated Args struct for ArgumentParser (emitted at module level) Stored here so it can be hoisted outside main() function

§generated_commands_enum: Option<TokenStream>

DEPYLER-0424: Generated Commands enum for subcommands (emitted at module level) Stored here so it can be hoisted outside main() function

§current_subcommand_fields: Option<HashSet<String>>

DEPYLER-0425: Current function’s subcommand fields (for expression rewriting) If current function accesses subcommand fields, this maps field names to variant name Used by expr_gen to rewrite args.field → field (extracted via pattern matching)

§validator_functions: HashSet<String>

DEPYLER-0447: Track argparse validator functions (type= parameter in add_argument) These functions should have &str parameter type regardless of type inference Populated when processing add_argument(type=validator_func) calls

§in_json_context: bool

DEPYLER-0461: Track whether we’re currently generating code inside a serde_json::json!() macro When true, nested dicts must also use json!() instead of HashMap (json!() doesn’t accept code blocks)

§stdlib_mappings: StdlibMappings

DEPYLER-0452: Stdlib API mapping system for Python→Rust API translations Maps Python stdlib patterns (module, class, attribute) to Rust code patterns

§hoisted_inference_vars: HashSet<String>

DEPYLER-0455 Bug 2: Track hoisted variables without type annotations These variables need String literal normalization (.to_string()) to ensure consistent type inference across if/else branches Example: let mut format; if x { format = “json”; } else { format = s.to_lowercase(); } Without normalization: &str vs String type mismatch With normalization: String vs String (consistent)

§none_placeholder_vars: HashSet<String>

DEPYLER-0823: Track variables assigned None placeholder that need hoisting When var = None; if cond: var = value; use(var), the None assignment is skipped but the variable must be hoisted before the if block to be accessible after it. Without hoisting: let var = value declared INSIDE if → E0425 outside With hoisting: let mut var; if cond { var = value; } → var accessible outside

§precomputed_option_fields: HashSet<String>

DEPYLER-0108: Track precomputed Option field checks for argparse Contains field names (e.g., “hash”) where we’ve precomputed let has_<field> = args.<field>.is_some(); Used by convert_method_call to substitute args.<field>.is_some() with has_<field>

§cse_subcommand_temps: HashMap<String, String>

DEPYLER-0456 Bug #2: Track CSE temp variables for subcommand checks Maps CSE temp variable names (e.g., “_cse_temp_0”) to command names (e.g., “init”) This allows is_subcommand_check() to recognize CSE-optimized subcommand comparisons

§nested_function_params: HashMap<String, Vec<HirParam>>

GH-70: Track inferred parameter types for nested functions/closures Maps nested function name → Vec with inferred types from usage patterns Used by stmt_gen.rs when generating closures to apply inferred parameter types instead of defaulting all parameters to () for Unknown types

§fn_str_params: HashSet<String>

DEPYLER-0543: Track function parameters with str type annotation These become &str in Rust and should NOT have & added when used as dict keys Populated when generating function signatures

§in_cmd_handler: bool

DEPYLER-0608: Track if currently generating a cmd_* handler function When true, expr_gen should transform args.X → X (field is now a direct parameter)

§cmd_handler_args_fields: Vec<String>

DEPYLER-0608: Track which fields were extracted from args.X accesses Used in cmd_* handlers to know which field names are now parameters

§in_subcommand_match_arm: bool

DEPYLER-0608: Track if in a subcommand match arm that calls a handler When true and calling cmd_/handle_ with args, pass extracted fields instead

§boxed_dyn_write_vars: HashSet<String>

DEPYLER-0625: Track variables that need Box type When a variable is assigned File in one if-branch and Stdout in another, we need to use Box<dyn std::io::Write> as the type and wrap values with Box::new()

§subcommand_match_fields: Vec<String>

DEPYLER-0608: Track extracted subcommand fields for match arm context These fields are bound via ref field patterns in the match arm

§hoisted_function_names: Vec<String>

DEPYLER-0613: Track names of functions that have been hoisted to top of body These should be skipped when processing nested blocks (if/while/for/try) to avoid duplicate emission

§is_main_function: bool

DEPYLER-0617: Track if currently generating code inside main() function When true, integer returns should become process::exit() or Ok(()) because Rust main can only return () or Result<(), E>

§function_returns_boxed_write: bool

DEPYLER-0626: Track if current function returns Box When a function returns both File and Stdout, we need trait object return Return statements should wrap values with Box::new()

§option_unwrap_map: HashMap<String, String>

DEPYLER-0627: Track Option variables unwrapped via if-let pattern Maps original variable name to unwrapped name (e.g., “override” -> “override_val”) Used inside if-let blocks to substitute variable references

§narrowed_option_vars: HashSet<String>

DEPYLER-1151: Track Option variables narrowed after None check with early return Pattern: if x.is_none() { return } narrows x to the inner type When x is used after this guard, we automatically unwrap it

§needs_completed_process: bool

DEPYLER-0627: Track if subprocess.run is used (needs CompletedProcess struct) When True, generate a CompletedProcess struct in the output

§vararg_functions: HashSet<String>

DEPYLER-0648: Track functions that have vararg parameters (*args in Python) These functions expect &[T] slice arguments, so call sites need to wrap args in &[…]

§slice_params: HashSet<String>

DEPYLER-1150: Track parameters in current function that are slices (from varargs) When returning a slice param in a function that returns Vec, add .to_vec()

§type_substitutions: HashMap<String, Type>

DEPYLER-0716: Type substitutions for current function’s generic inference When a type parameter T can be inferred to a concrete type (e.g., String), this maps “T” -> String. Used to substitute in return types.

§current_assign_type: Option<Type>

DEPYLER-0727: Track assignment target type for dict literal Value wrapping When assigning to a variable with type annotation (e.g., d: Dict[str, Any] = {...}), this stores the annotation so dict codegen can wrap values in serde_json::json!()

§force_dict_value_option_wrap: bool

DEPYLER-0741: Force dict values to be wrapped in Some() when in list context When generating a list of dicts where ANY dict has None values, all dicts must use Option for consistency. This flag is set by convert_list.

§function_param_optionals: HashMap<String, Vec<bool>>

DEPYLER-0737: Track which function parameters are Optional (from =None default) Maps function name → Vec where true means param at that index is Option Used by call sites to wrap non-None values in Some()

§char_iter_vars: HashSet<String>

DEPYLER-0795: Track loop variables that iterate over string.chars() These variables are char type in Rust (not str), so ord(var) should be var as u32 not var.chars().next().unwrap() as i32

§char_counter_vars: HashSet<String>

DEPYLER-0821: Track Counter variables created from strings (HashMap<char, i32>) Used to mark key variables as char when iterating with .items()

§adt_child_to_parent: HashMap<String, String>

DEPYLER-0936: Track ADT child→parent mappings for type rewriting When a Python ABC hierarchy is converted to a Rust enum (e.g., Iter with children ListIter, RangeIter), return types mentioning children must be rewritten to parent. Maps child name (e.g., “ListIter”) → parent name (e.g., “Iter”)

§function_param_types: HashMap<String, Vec<Type>>

DEPYLER-0950: Track function parameter types for literal coercion at call sites Maps function name → Vec for each parameter position Used to coerce integer literals to float literals when callee expects f64

§mut_option_dict_params: HashSet<String>

DEPYLER-0964: Track function parameters that are &mut Option<Dict> type When a parameter has type Dict[K,V] with default None, it becomes &mut Option Inside the function body, assignments and method calls need special handling:

  • Assignment: memo = {}*memo = Some(HashMap::new())
  • Method calls: memo.get(k)memo.as_ref().unwrap().get(&k)
  • Subscript: memo[k] = vmemo.as_mut().unwrap().insert(k, v)
§mut_option_params: HashSet<String>

DEPYLER-1126: Track ALL parameters that are &mut Option<T> (any T, not just Dict) When a parameter has Optional type and is mutated in the function body, it becomes &mut Option. Assignments need dereferencing: *param = value

§needs_depyler_value_enum: bool§needs_python_string_ops: bool§needs_python_int_ops: bool§needs_depyler_date: bool§needs_depyler_datetime: bool§needs_depyler_timedelta: bool§needs_depyler_regex_match: bool§module_constant_types: HashMap<String, Type>

DEPYLER-1060: Track module-level constant types (dict, list, set) These persist across function boundaries and aren’t cleared when processing functions. Used by is_dict_expr() to recognize module-level statics accessed from within functions.

§last_external_call_return_type: Option<String>

DEPYLER-1113: Last external call return type for assignment propagation When a MethodCall on an external module is encountered (e.g., requests.get), stores the return type string for use when processing the assignment. Reset to None after the assignment is processed.

§type_overrides: HashMap<String, Type>

DEPYLER-1101: Oracle-learned type overrides from E0308 error feedback When the compiler reports “expected X, found Y”, we learn the correct type. Maps variable name -> correct Type. Overrides inferred types during codegen. Populated by repair_file_types() in utol.rs via transpile_with_constraints().

§vars_used_later: HashSet<String>

DEPYLER-1168: Track variables that are used after the current statement When a function takes ownership of a parameter and the argument variable is used later in the same scope, we need to insert .clone() at the call site. Populated during statement iteration in stmt_gen.rs.

Implementations§

Source§

impl<'a> CodeGenContext<'a>

Source

pub fn enter_scope(&mut self)

Enter a new lexical scope

§Complexity

1 (simple push)

Source

pub fn exit_scope(&mut self)

Exit the current lexical scope

§Complexity

1 (simple pop)

Source

pub fn is_declared(&self, var_name: &str) -> bool

Check if a variable is declared in any scope

§Complexity

2 (iterator + any)

Source

pub fn declare_var(&mut self, var_name: &str)

Declare a variable in the current scope

§Complexity

2 (if let + insert)

Source

pub fn process_union_type(&mut self, types: &[Type]) -> String

Process a Union type and generate an enum if needed

Returns the enum name and optionally generates an enum definition that is added to generated_enums.

§Complexity

2 (if + push)

Source

pub fn current_exception_scope(&self) -> &ExceptionScope

Get the current exception scope

Returns the most recent scope from the stack, or Unhandled if stack is empty.

§Complexity

2 (last + unwrap_or)

Source

pub fn is_in_try_block(&self) -> bool

Check if currently inside a try block

§Complexity

2 (current_exception_scope + matches)

Source

pub fn is_exception_handled(&self, exception_type: &str) -> bool

Check if a specific exception type is handled by current try block

Returns true if:

  • Inside a try block with bare except (empty handled_types)
  • Inside a try block that explicitly handles this exception type
§Complexity

4 (match + is_empty + contains + comparison)

Source

pub fn enter_try_scope(&mut self, handled_types: Vec<String>)

Enter a try block scope with specified exception handlers

§Complexity

1 (simple push)

Source

pub fn enter_handler_scope(&mut self)

Enter an exception handler scope

§Complexity

1 (simple push)

Source

pub fn exit_exception_scope(&mut self)

Exit the current exception scope

§Complexity

1 (simple pop)

Source

pub fn exception_nesting_depth(&self) -> usize

Returns the current exception scope nesting depth

DEPYLER-0931: Used to detect nested try/except blocks for proper return wrapping. When inside nested try/except, returns from inner match arms must be wrapped in Ok() to match the outer closure’s Result<T, E> return type.

§Complexity

1 (len() call)

Source

pub fn fallback_type_annotation(&mut self) -> TokenStream

DEPYLER-1022: Return the fallback type annotation based on NASA mode

In NASA mode (default), returns : String to avoid external crate dependencies. In non-NASA mode, returns : serde_json::Value and sets needs_serde_json flag.

§Complexity

2 (if + quote)

Source

pub fn fallback_type(&mut self) -> TokenStream

DEPYLER-1022: Return the fallback type (without colon) based on NASA mode

In NASA mode, returns String. In non-NASA mode, returns serde_json::Value.

§Complexity

2 (if + quote)

Source

pub fn lookup_external_return_type( &self, _module: &str, _symbol: &str, ) -> Option<String>

DEPYLER-1112: Stub for when sovereign-types feature is disabled

Always returns None since the type database is not available.

Source

pub fn has_external_symbol(&self, _module: &str, _symbol: &str) -> bool

DEPYLER-1112: Stub for when sovereign-types feature is disabled

Auto Trait Implementations§

§

impl<'a> !Send for CodeGenContext<'a>

§

impl<'a> !Sync for CodeGenContext<'a>

§

impl<'a> Freeze for CodeGenContext<'a>

§

impl<'a> RefUnwindSafe for CodeGenContext<'a>

§

impl<'a> Unpin for CodeGenContext<'a>

§

impl<'a> UnsafeUnpin for CodeGenContext<'a>

§

impl<'a> UnwindSafe for CodeGenContext<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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