Skip to main content

Class

Struct Class 

Source
pub struct Class { /* private fields */ }
Expand description

A builtin exception class, as a value.

This is what the name ValueError is bound to. Calling it makes an Exception, which is the only thing it does, and which is why it holds nothing but the Kind it constructs.

Implementations§

Source§

impl Class

Source

pub const fn new(kind: Kind) -> Self

The class for this kind.

Source

pub const fn kind(self) -> Kind

Which class it is.

Source

pub fn instance(self, args: Vec<Object>) -> Object

An instance of it, which is what calling the class does.

Trait Implementations§

Source§

impl Clone for Class

Source§

fn clone(&self) -> Class

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Class

Source§

impl Debug for Class

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Class

Source§

impl Native for Class

Source§

fn type_name(&self) -> &str

The type of a class is type, the same as for every other class.

Source§

fn repr(&self) -> String

What repr prints. Read more
Source§

fn as_any(&self) -> &dyn Any

The concrete value, for the runtime to downcast back to.
Source§

fn display(&self) -> String

What str prints, which for a type with no __str__ of its own is whatever repr prints. Almost every native type wants the default. An exception is the one that does not, because str(e) is the message and repr(e) is the call that would make it again.
Source§

fn truthy(&self) -> bool

Python’s truth protocol, which for an object with no __bool__ and no __len__ is true. Almost every native type wants the default.
Source§

fn walking(&self) -> bool

Whether this is already an iterator, meaning iter(x) is x and a for over a half consumed one carries on rather than starting again. Read more
Source§

fn equals(&self, _other: &dyn Native) -> bool

Whether this is equal to another native value that is not the same object as it. Read more
Source§

fn hash(&self) -> Option<i64>

This value’s hash, or nothing to be hashed by address like an object with no __hash__ of its own. Read more
Source§

impl PartialEq for Class

Source§

fn eq(&self, other: &Class) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Class

Auto Trait Implementations§

§

impl Freeze for Class

§

impl RefUnwindSafe for Class

§

impl Send for Class

§

impl Sync for Class

§

impl Unpin for Class

§

impl UnsafeUnpin for Class

§

impl UnwindSafe for Class

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.