Skip to main content

TenantId

Struct TenantId 

Source
pub struct TenantId(/* private fields */);
Expand description

One tenant’s id, and the field type of a resource’s tenant column.

A model declares its tenant column with this type:

#[derive(Debug, Clone, toasty::Model)]
pub struct Note {
    #[key]
    #[auto]
    id: uuid::Uuid,
    #[index]
    tenant_id: TenantId,
    body: String,
}

Tenancy::column and Tenancy::via accept only a TenantColumn, so a lens naming any other Uuid column — an author, a parent row, the key — does not compile. The column stores a UUID, so the database column is unchanged.

Implementations§

Source§

impl TenantId

Source

pub fn get(self) -> Uuid

The id, as tenant_id answers it and a session carries it.

Trait Implementations§

Source§

impl Assign<TenantId> for TenantId

Source§

fn into_assignment(self) -> Assignment<TenantId>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl Clone for TenantId

Source§

fn clone(&self) -> Self

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 TenantId

Source§

impl Debug for TenantId

Source§

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

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

impl Display for TenantId

Source§

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

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

impl Eq for TenantId

Source§

impl Field for TenantId

Source§

type ExprTarget = TenantId

The expression-level type of this field. Read more
Source§

type Path<Origin> = Path<Origin, TenantId>

The type returned when accessing this field from a Fields struct. For primitives, this is Path<Origin, Self>. For embedded types, this is {Type}Fields.
Source§

type ListPath<Origin> = Path<Origin, List<<TenantId as Field>::ExprTarget>>

The type returned when accessing this field from a list Fields struct. For primitives, this is Path<Origin, ListSelf::ExprTarget>. For embedded types, this is {Type}ListFields.
Source§

type Update<'a> = ()

The type of the update builder for this field. For embedded types, this is {Type}Update<’a>. For primitives, this will be {Type}Update<’a> once implemented.
Source§

type Inner = TenantId

The unwrapped type used for foreign key filter expressions. Primitives map to themselves. Wrappers like Option<T>, Box<T>, Arc<T>, and Rc<T> map to T::Inner.
Source§

fn new_path<Origin>(path: Path<Origin, Self>) -> Self::Path<Origin>

Build a field path from a raw path of the field’s Self::ExprTarget. Read more
Source§

fn new_list_path<Origin>( path: Path<Origin, List<Self::ExprTarget>>, ) -> Self::ListPath<Origin>

Build a list field path from a raw path. For primitives, returns the path as-is. For embedded types, wraps the path in a ListFields struct.
Source§

fn new_update<'a>( _assignments: &'a mut Assignments, _projection: Projection, ) -> Self::Update<'a>

Build an update builder from assignments and a projection. For primitives, this returns () (no builder). For embedded types, this is overridden to construct the {Type}Update builder.
Source§

fn key_constraint<Origin>( &self, target: Path<Origin, Self::Inner>, ) -> Expr<bool>

Build a boolean filter expression comparing this field value against a target path. Used by generated belongs-to accessors to build FK lookups. Read more
Source§

const NULLABLE: bool = false

Whether or not the type is nullable
Source§

const DEFERRED: bool = false

Whether this field is omitted from default loads.
Source§

fn field_ty(storage_ty: Option<Type>) -> FieldTy

Returns the app-level field type for this primitive. Default implementation returns a Primitive field type. Embedded types override this to return Embedded field type.
Source§

fn register(_model_set: &mut ModelSet)

Register any models referenced by this field type into the given ModelSet. Read more
Source§

impl From<Uuid> for TenantId

Source§

fn from(id: Uuid) -> Self

Converts to this type from the input type.
Source§

impl FromStr for TenantId

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(text: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for TenantId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IndexableField for TenantId

Source§

impl IntoExpr<TenantId> for TenantId

Source§

fn into_expr(self) -> Expr<TenantId>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<TenantId>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl Load for TenantId

Source§

type Output = TenantId

The concrete type produced by load. Read more
Source§

fn ty() -> Type

Returns the stmt::Type that describes values of this type.
Source§

fn load(value: Value) -> Result<Self::Output, Error>

Deserialize a database Value into Self::Output. Read more
Source§

fn reload(target: &mut Self::Output, value: Value) -> Result<(), Error>

Reload the value in-place from a value returned by the database. Read more
Source§

fn ty_relation() -> Type

Returns the stmt::Type used when this type appears as a relation target. The default delegates to ty().
Source§

fn load_relation(value: Value) -> Result<Self::Output, Error>

Deserialize a value that was loaded as a relation target. Read more
Source§

impl Ord for TenantId

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for TenantId

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialOrd for TenantId

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for TenantId

Source§

impl TenantColumn for TenantId

Source§

fn from_tenant(id: Uuid) -> Self

The column’s value for the request tenant id.
Source§

impl TypedValue for TenantId

Source§

const NOUN: &'static str = "identifier"

What this type is called in a validation error.
Source§

const INPUT_TYPE: &'static str = "text"

The type attribute of the text control that edits it.
Source§

fn parse_input(value: &str) -> Option<Self>

Reads a trimmed, non-empty submission, or None when the type refuses it.

Auto Trait Implementations§

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> Assign<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Arc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Box<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Option<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Rc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneAny for T
where T: Any + Clone,

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<K> ForeignKey<K> for K
where K: IntoExpr<K> + FormScalar + Send + Sync + 'static,

Source§

impl<T> FormScalar for T
where T: TypedValue,

Source§

const INPUT_TYPE: &'static str = const INPUT_TYPE: &'static str = T::INPUT_TYPE;

The type attribute of the text control that edits it.
Source§

fn parse_form(value: &str) -> Result<T, String>

Parse a trimmed, non-empty submission, or return the error message.
Source§

fn to_form(&self) -> String

The form spelling of a stored value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoExpr<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Arc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Arc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Box<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Box<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Option<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Option<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Rc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Rc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more