Struct virtue::parse::GenericConstraints
source · pub struct GenericConstraints { /* private fields */ }
Expand description
Constraints on generic types.
struct Foo<F>
where F: Display // These are `GenericConstraints`
{
f: PhantomData<F>
}
Implementations§
source§impl GenericConstraints
impl GenericConstraints
sourcepub fn push_constraint(
&mut self,
generic: &SimpleGeneric,
constraint: impl AsRef<str>
) -> Result<()>
pub fn push_constraint( &mut self, generic: &SimpleGeneric, constraint: impl AsRef<str> ) -> Result<()>
Push the given constraint onto this stream.
ⓘ
let mut generic_constraints = GenericConstraints::parse("T: Foo"); // imaginary function
let mut generic = SimpleGeneric::new("U"); // imaginary function
generic_constraints.push_constraint(&generic, "Bar");
// generic_constraints is now:
// `T: Foo, U: Bar`
sourcepub fn push_parsed_constraint(
&mut self,
constraint: impl AsRef<str>
) -> Result<()>
pub fn push_parsed_constraint( &mut self, constraint: impl AsRef<str> ) -> Result<()>
Push the given constraint onto this stream.
ⓘ
let mut generic_constraints = GenericConstraints::parse("T: Foo"); // imaginary function
generic_constraints.push_parsed_constraint("u32: SomeTrait");
// generic_constraints is now:
// `T: Foo, u32: SomeTrait`
Trait Implementations§
source§impl Clone for GenericConstraints
impl Clone for GenericConstraints
source§fn clone(&self) -> GenericConstraints
fn clone(&self) -> GenericConstraints
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for GenericConstraints
impl Debug for GenericConstraints
source§impl Default for GenericConstraints
impl Default for GenericConstraints
source§fn default() -> GenericConstraints
fn default() -> GenericConstraints
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GenericConstraints
impl RefUnwindSafe for GenericConstraints
impl !Send for GenericConstraints
impl !Sync for GenericConstraints
impl Unpin for GenericConstraints
impl UnwindSafe for GenericConstraints
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