Struct google_cloud_spanner::row::Struct
source · pub struct Struct<'a> { /* private fields */ }Implementations§
source§impl<'a> Struct<'a>
impl<'a> Struct<'a>
sourcepub fn new(
metadata: &'a StructType,
item: &'a Value,
field: &'a Field
) -> Result<Struct<'a>, Error>
pub fn new(
metadata: &'a StructType,
item: &'a Value,
field: &'a Field
) -> Result<Struct<'a>, Error>
Examples found in repository?
src/row.rs (line 244)
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
fn try_from(item: &Value, field: &Field) -> Result<Self, Error> {
let maybe_array = match field.r#type.as_ref() {
None => return Err(Error::StructParseError(field.name.to_string(), "field type must not be none")),
Some(tp) => tp.array_element_type.as_ref(),
};
let maybe_struct_type = match maybe_array {
None => return Err(Error::StructParseError(field.name.to_string(), "array must not be none")),
Some(tp) => tp.struct_type.as_ref(),
};
let struct_type = match maybe_struct_type {
None => {
return Err(Error::StructParseError(
field.name.to_string(),
"struct type in array must not be none ",
))
}
Some(struct_type) => struct_type,
};
T::try_from_struct(Struct::new(struct_type, item, field)?)
}pub fn column_by_name<T>(&self, column_name: &str) -> Result<T, Error>where
T: TryFromValue,
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Struct<'a>
impl<'a> Send for Struct<'a>
impl<'a> Sync for Struct<'a>
impl<'a> Unpin for Struct<'a>
impl<'a> UnwindSafe for Struct<'a>
Blanket Implementations§
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> 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