pub struct StructType(/* private fields */);
Expand description
The Cloud Spanner Struct
type which is composed of optionally named fields and their data type.
Implementations§
Source§impl StructType
impl StructType
Sourcepub fn new(fields: Vec<(&str, Type)>) -> Self
pub fn new(fields: Vec<(&str, Type)>) -> Self
Creates a new StructType
with the provided fields.
Note that Cloud Spanner allows “unnamed” fields. If a provided field name is the empty string,
it will be converted to a None
in the resulting StructType
.
Sourcepub fn fields(&self) -> &Vec<(Option<String>, Type)>
pub fn fields(&self) -> &Vec<(Option<String>, Type)>
Returns a reference to this struct’s fields.
Sourcepub fn field_names(&self) -> impl Iterator<Item = &Option<String>>
pub fn field_names(&self) -> impl Iterator<Item = &Option<String>>
Returns an iterator over the names of this struct’s fields.
Sourcepub fn types(&self) -> impl Iterator<Item = &Type>
pub fn types(&self) -> impl Iterator<Item = &Type>
Returns an iterator over the types of this struct’s fields.
Sourcepub fn field_index(&self, field_name: &str) -> Option<usize>
pub fn field_index(&self, field_name: &str) -> Option<usize>
Returns the index of the provided field name.
Returns None
if no field matches the provided name.
Note that this function ignores unnamed fields.
Trait Implementations§
Source§impl Clone for StructType
impl Clone for StructType
Source§fn clone(&self) -> StructType
fn clone(&self) -> StructType
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 StructType
impl Debug for StructType
Source§impl Default for StructType
impl Default for StructType
Source§fn default() -> StructType
fn default() -> StructType
Returns the “default value” for a type. Read more
Source§impl PartialEq for StructType
impl PartialEq for StructType
Source§impl TryFrom<&StructType> for StructType
impl TryFrom<&StructType> for StructType
Source§impl TryFrom<StructType> for StructType
impl TryFrom<StructType> for StructType
impl StructuralPartialEq for StructType
Auto Trait Implementations§
impl Freeze for StructType
impl RefUnwindSafe for StructType
impl Send for StructType
impl Sync for StructType
impl Unpin for StructType
impl UnwindSafe for StructType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request