pub struct Field {
pub name: String,
pub type_annotation: Option<String>,
pub visibility: String,
pub is_static: bool,
pub is_constant: bool,
pub default_value: Option<String>,
}Expand description
Represents a class field/attribute
Fields§
§name: StringField name
type_annotation: Option<String>Type annotation (if available)
visibility: StringVisibility: “public”, “private”, “protected”
is_static: boolIs this a static/class field?
is_constant: boolIs this a constant?
default_value: Option<String>Default value
Implementations§
Source§impl Field
impl Field
pub fn new(name: impl Into<String>) -> Self
pub fn with_type(self, type_ann: impl Into<String>) -> Self
pub fn with_visibility(self, vis: impl Into<String>) -> Self
pub fn static_field(self) -> Self
pub fn constant(self) -> Self
pub fn with_default(self, default: impl Into<String>) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Field
impl<'de> Deserialize<'de> for Field
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
impl Eq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
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