pub struct TraitDef {
pub name: String,
pub doc_comment: Option<DocComment>,
pub type_params: Option<Vec<TypeParam>>,
pub super_traits: Vec<TypeAnnotation>,
pub members: Vec<TraitMember>,
pub annotations: Vec<Annotation>,
}Expand description
Trait definition — like interface but with trait keyword, supporting default methods
trait Queryable<T> {
filter(predicate: (T) => bool): Self // required
method execute() -> Result<Table<T>> { // default
return Ok(self.filter(|_| true))
}
}Fields§
§name: String§doc_comment: Option<DocComment>§type_params: Option<Vec<TypeParam>>§super_traits: Vec<TypeAnnotation>Supertrait bounds: trait Foo: Bar + Baz { ... }
members: Vec<TraitMember>§annotations: Vec<Annotation>Annotations applied to the trait (e.g., @documented("...") trait Foo { ... })
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TraitDef
impl<'de> Deserialize<'de> for TraitDef
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
Auto Trait Implementations§
impl Freeze for TraitDef
impl RefUnwindSafe for TraitDef
impl Send for TraitDef
impl Sync for TraitDef
impl Unpin for TraitDef
impl UnsafeUnpin for TraitDef
impl UnwindSafe for TraitDef
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