pub struct ClassEntity {Show 13 fields
pub name: String,
pub visibility: String,
pub line_start: usize,
pub line_end: usize,
pub is_abstract: bool,
pub is_interface: bool,
pub base_classes: Vec<String>,
pub implemented_traits: Vec<String>,
pub methods: Vec<FunctionEntity>,
pub fields: Vec<Field>,
pub doc_comment: Option<String>,
pub attributes: Vec<String>,
pub type_parameters: Vec<String>,
}Expand description
Represents a class/struct in any language
Fields§
§name: StringClass name
visibility: StringVisibility: “public”, “private”, “internal”
line_start: usizeStarting line number (1-indexed)
line_end: usizeEnding line number (1-indexed)
is_abstract: boolIs this an abstract class?
is_interface: boolIs this an interface/trait definition?
base_classes: Vec<String>Base classes (inheritance)
implemented_traits: Vec<String>Interfaces/traits implemented
methods: Vec<FunctionEntity>Methods in this class
fields: Vec<Field>Fields/attributes
doc_comment: Option<String>Documentation/docstring
attributes: Vec<String>Decorators/attributes
type_parameters: Vec<String>Generic type parameters (if any)
Implementations§
Source§impl ClassEntity
impl ClassEntity
pub fn new(name: impl Into<String>, line_start: usize, line_end: usize) -> Self
pub fn with_visibility(self, vis: impl Into<String>) -> Self
pub fn abstract_class(self) -> Self
pub fn interface(self) -> Self
pub fn with_bases(self, bases: Vec<String>) -> Self
pub fn with_traits(self, traits: Vec<String>) -> Self
pub fn with_methods(self, methods: Vec<FunctionEntity>) -> Self
pub fn with_fields(self, fields: Vec<Field>) -> Self
pub fn with_doc(self, doc: impl Into<String>) -> Self
pub fn with_attributes(self, attrs: Vec<String>) -> Self
pub fn with_type_parameters(self, type_params: Vec<String>) -> Self
Trait Implementations§
Source§impl Clone for ClassEntity
impl Clone for ClassEntity
Source§fn clone(&self) -> ClassEntity
fn clone(&self) -> ClassEntity
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClassEntity
impl Debug for ClassEntity
Source§impl<'de> Deserialize<'de> for ClassEntity
impl<'de> Deserialize<'de> for ClassEntity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ClassEntity
impl PartialEq for ClassEntity
Source§impl Serialize for ClassEntity
impl Serialize for ClassEntity
impl StructuralPartialEq for ClassEntity
Auto Trait Implementations§
impl Freeze for ClassEntity
impl RefUnwindSafe for ClassEntity
impl Send for ClassEntity
impl Sync for ClassEntity
impl Unpin for ClassEntity
impl UnwindSafe for ClassEntity
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)