#[repr(u8)]
pub enum Role {
Active,
Viewer,
Editor,
Administrator,
}Expand description
A role that can be assigned to a user
The u8 representation is meant for database storage/retrieval
Variants§
Implementations§
source§impl Role
impl Role
pub const fn get_permissions(&self) -> &'static [Permission]
pub fn all() -> Vec<Self> ⓘ
Trait Implementations§
source§impl<'de> Deserialize<'de> for Role
impl<'de> Deserialize<'de> for Role
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 JsonSchema for Role
impl JsonSchema for Role
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moresource§impl Ord for Role
impl Ord for Role
source§impl PartialEq<Role> for Role
impl PartialEq<Role> for Role
source§impl PartialOrd<Role> for Role
impl PartialOrd<Role> for Role
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl ToSql for Role
impl ToSql for Role
source§fn to_sql(
&self,
_type: &Type,
buf: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql(
&self,
_type: &Type,
buf: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
Converts the value of
self into the binary format of the specified
Postgres Type, appending it to out. Read moresource§fn accepts(type_: &Type) -> bool
fn accepts(type_: &Type) -> bool
Determines if a value of this type can be converted to the specified
Postgres
Type.source§fn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
An adaptor method used internally by Rust-Postgres. Read more
source§fn encode_format(&self, _ty: &Type) -> Format
fn encode_format(&self, _ty: &Type) -> Format
Specify the encode format
source§impl TryFrom<u8> for Role
impl TryFrom<u8> for Role
§type Error = TryFromPrimitiveError<Role>
type Error = TryFromPrimitiveError<Role>
The type returned in the event of a conversion error.
source§impl TryFromPrimitive for Role
impl TryFromPrimitive for Role
impl Copy for Role
impl Eq for Role
impl StructuralEq for Role
impl StructuralPartialEq for Role
Auto Trait Implementations§
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnwindSafe for Role
Blanket Implementations§
source§impl<T> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
source§fn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to
self as a ToSql trait object.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.