pub struct Dependencies {Show 16 fields
pub needs_clamp: bool,
pub needs_store: bool,
pub needs_load: bool,
pub needs_validate_guest_char: bool,
pub needs_expected: bool,
pub needs_i32_to_f32: bool,
pub needs_f32_to_i32: bool,
pub needs_i64_to_f64: bool,
pub needs_f64_to_i64: bool,
pub needs_decode_utf8: bool,
pub needs_encode_utf8: bool,
pub needs_list_canon_lift: bool,
pub needs_list_canon_lower: bool,
pub needs_t_typevar: bool,
pub needs_resources: bool,
pub pyimports: BTreeMap<String, Option<BTreeSet<String>>>,
}
Expand description
Tracks all of the import and intrinsics that a given codegen requires and how to generate them when needed.
Fields§
§needs_clamp: bool
§needs_store: bool
§needs_load: bool
§needs_validate_guest_char: bool
§needs_expected: bool
§needs_i32_to_f32: bool
§needs_f32_to_i32: bool
§needs_i64_to_f64: bool
§needs_f64_to_i64: bool
§needs_decode_utf8: bool
§needs_encode_utf8: bool
§needs_list_canon_lift: bool
§needs_list_canon_lower: bool
§needs_t_typevar: bool
§needs_resources: bool
§pyimports: BTreeMap<String, Option<BTreeSet<String>>>
Implementations§
source§impl Dependencies
impl Dependencies
sourcepub fn pyimport<'a>(&mut self, module: &str, name: impl Into<Option<&'a str>>)
pub fn pyimport<'a>(&mut self, module: &str, name: impl Into<Option<&'a str>>)
Record that a Python import is required
Examples
// Import a specific item from a module
deps.pyimport("typing", "NamedTuple");
// Import an entire module
deps.pyimport("collections", None);
sourcepub fn intrinsics(&mut self) -> Source
pub fn intrinsics(&mut self) -> Source
Create a Source
containing all of the intrinsics
required according to this Dependencies
struct.
Trait Implementations§
source§impl Default for Dependencies
impl Default for Dependencies
source§fn default() -> Dependencies
fn default() -> Dependencies
Returns the “default value” for a type. Read more