Skip to main content

TableName

Struct TableName 

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

A table name, as the engine holds it and as it is encoded to storage.

Deliberately carries no rendering and no conversion to the public wire type. Both belong to the language layer, where a name is escaped if it would otherwise read back as a reserved word — see surrealdb_sql::TableName. Keeping them off this type is what lets this crate stay a string primitive rather than depending on the formatting and public-type crates.

It also deliberately does not deref to str. str implements ToSql, so while it did, writing name.fmt_sql(..) resolved to the unescaped string rendering instead of failing to compile, and a name that could not be read back was emitted. Reaching the text requires TableName::as_str, which makes the choice of escaper explicit at every call site.

That absence is load-bearing rather than incidental, so it is pinned here: re-adding the impl makes this compile, and the test fails.

ⓘ
let name = surrealdb_strand::TableName::from("person");
let _: &str = &name;

Implementations§

Source§

impl TableName

Source

pub fn new(s: impl Into<Strand>) -> TableName

Create a new table name.

Source

pub fn into_string(self) -> String

Source

pub fn as_str(&self) -> &str

Source

pub fn is_table_type(&self, tables: &[TableName]) -> bool

Trait Implementations§

Source§

impl AsRef<str> for TableName

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<str> for TableName

Source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
Source§

impl<'de, F> BorrowDecode<'de, F> for TableName

Source§

impl Cast for TableName

Source§

fn can_cast(v: &Value) -> bool

Returns true if calling cast on the value will succeed. Read more
Source§

fn cast(v: Value) -> Result<Self, CastError>

Cast a value to the self type.
Source§

impl Clone for TableName

Source§

fn clone(&self) -> TableName

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 Coerce for TableName

Source§

fn can_coerce(v: &Value) -> bool

Returns if calling coerce on the value will succeed or not. Read more
Source§

fn coerce(v: Value) -> Result<Self, CoerceError>

Coerce a value.
Source§

impl Debug for TableName

Source§

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

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

impl<F> Decode<F> for TableName

Source§

fn decode<R>(r: &mut Reader<R>) -> Result<TableName, DecodeError>
where R: BufRead,

Source§

impl Default for TableName

Source§

fn default() -> TableName

Returns the “default value” for a type. Read more
Source§

impl DeserializeRevisioned for TableName

Source§

fn deserialize_revisioned<R>(r: &mut R) -> Result<TableName, Error>
where R: Read,

Deserializes a new instance of the struct from the specified reader.
Source§

impl Display for TableName

Source§

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

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

impl<F> Encode<F> for TableName

Source§

fn encode<W>(&self, w: &mut Writer<W>) -> Result<(), EncodeError>
where W: Write,

Source§

impl Eq for TableName

Source§

impl From<&str> for TableName

Source§

fn from(value: &str) -> TableName

Converts to this type from the input type.
Source§

impl From<Strand> for TableName

Source§

fn from(value: Strand) -> TableName

Converts to this type from the input type.
Source§

impl From<String> for TableName

Source§

fn from(value: String) -> TableName

Converts to this type from the input type.
Source§

impl From<TableName> for Strand

Source§

fn from(value: TableName) -> Strand

Converts to this type from the input type.
Source§

impl From<TableName> for TableName

Lowering: the syntax tree’s name becomes the engine’s.

Source§

fn from(value: TableName) -> TableName

Converts to this type from the input type.
Source§

impl From<TableName> for Value

Source§

fn from(v: TableName) -> Self

Converts to this type from the input type.
Source§

impl HasKind for TableName

Source§

impl Hash for TableName

Source§

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

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 IntoPublicTable for TableName

Source§

impl LengthPrefixedBytes for TableName

Source§

impl Ord for TableName

Source§

fn cmp(&self, other: &TableName) -> 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 TableName

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialEq<&str> for TableName

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialEq<String> for TableName

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialEq<TableName> for &TableName

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialEq<str> for TableName

Source§

fn eq(&self, other: &str) -> 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 TableName

Source§

fn partial_cmp(&self, other: &TableName) -> 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 Revisioned for TableName

Source§

fn revision() -> u16

Returns the current revision of this type.
Source§

fn type_id() -> TypeId
where Self: 'static,

Returns the type id of this type.
Source§

impl SerializeRevisioned for TableName

Source§

fn serialize_revisioned<W>(&self, w: &mut W) -> Result<(), Error>
where W: Write,

Serializes the struct using the specified writer.
Source§

impl SkipRevisioned for TableName

Source§

fn skip_revisioned<R>(r: &mut R) -> Result<(), Error>
where R: Read,

Source§

fn skip_revisioned_slice(r: &mut SliceReader<'_>) -> Result<(), Error>

Consume through bytes backed by SliceReader without allocating a buffer for bulk segments. Read more
Source§

impl StructuralPartialEq for TableName

Source§

impl WalkRevisioned for TableName

Source§

type Walker<'r, R: BorrowedReader + 'r> = LeafWalker<'r, TableName, R>

Walker produced by walk_revisioned. Read more
Source§

fn walk_revisioned<'r, R>( reader: &'r mut R, ) -> Result<<TableName as WalkRevisioned>::Walker<'r, R>, Error>
where R: BorrowedReader,

Read the type’s revision-level prefix and return a walker positioned at the start of the body. Read more

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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<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<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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SetEntry<T> for T
where T: Hash + Eq,

Source§

fn into_owned(self) -> T

Source§

fn equal(&self, other: &T) -> bool

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

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool