pub struct StructDef {
pub name: String,
pub path: String,
pub generics: Vec<GenericParam>,
/* private fields */
}Expand description
A reflected struct definition with navigation methods.
Provides access to struct metadata and navigation to related types like fields, trait implementations, and methods.
§Example
ⓘ
use bronzite_client::Crate;
let krate = Crate::reflect("my_crate")?;
let user = krate.get_struct("User")?;
// Get fields
for field in user.fields()? {
println!("Field: {} of type {}",
field.name.unwrap_or_default(),
field.ty
);
}
// Check trait implementation
if user.implements("Debug")? {
println!("User implements Debug");
}
// Get methods
for method in user.methods()? {
println!("Method: {}", method.name);
}Fields§
§name: StringThe struct’s name (without path)
path: StringThe struct’s full path
generics: Vec<GenericParam>Generic parameters
Implementations§
Source§impl StructDef
impl StructDef
Sourcepub fn trait_impls(&self) -> Result<Vec<TraitImpl>>
pub fn trait_impls(&self) -> Result<Vec<TraitImpl>>
Get trait implementations for this struct.
Sourcepub fn implements(&self, trait_path: &str) -> Result<bool>
pub fn implements(&self, trait_path: &str) -> Result<bool>
Check if this struct implements a specific trait.
Sourcepub fn methods(&self) -> Result<Vec<Method>>
pub fn methods(&self) -> Result<Vec<Method>>
Get inherent methods (from impl StructName { ... } blocks).
Sourcepub fn layout(&self) -> Result<LayoutInfo>
pub fn layout(&self) -> Result<LayoutInfo>
Get memory layout information.
Sourcepub fn details(&self) -> Option<&TypeDetails>
pub fn details(&self) -> Option<&TypeDetails>
Get detailed type information.
Sourcepub fn visibility(&self) -> Option<&Visibility>
pub fn visibility(&self) -> Option<&Visibility>
Get visibility of this struct.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StructDef
impl RefUnwindSafe for StructDef
impl Send for StructDef
impl Sync for StructDef
impl Unpin for StructDef
impl UnwindSafe for StructDef
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