pub struct StructType(Arc<StructTypeInner>);Expand description
A cheaply cloneable struct type.
Tuple Fields§
§0: Arc<StructTypeInner>Implementations§
Source§impl StructType
impl StructType
Sourcepub fn new(
named_fields: impl IntoIterator<Item = (impl Into<String>, DataType)>,
) -> Self
pub fn new( named_fields: impl IntoIterator<Item = (impl Into<String>, DataType)>, ) -> Self
Creates a struct type with named fields.
Sourcepub fn unnamed(fields: impl IntoIterator<Item = DataType>) -> Self
pub fn unnamed(fields: impl IntoIterator<Item = DataType>) -> Self
Creates a struct type with unnamed fields. The names will be assigned f1, f2, etc.
Sourcepub fn row_expr_type(fields: impl IntoIterator<Item = DataType>) -> Self
pub fn row_expr_type(fields: impl IntoIterator<Item = DataType>) -> Self
Creates a struct type for ROW expression with unnamed fields.
Sourcepub fn with_ids(self, ids: impl IntoIterator<Item = ColumnId>) -> Self
pub fn with_ids(self, ids: impl IntoIterator<Item = ColumnId>) -> Self
Attaches given field ids to the struct type.
Note that for empty struct, this method is a no-op, as StructType::ids will always
return Some(<empty>) for empty struct.
Sourcepub fn has_ids(&self) -> bool
pub fn has_ids(&self) -> bool
Whether the struct type has field ids. An empty struct is considered to have ids.
Note that this does not recursively check whether composite fields have ids.
Sourcepub fn is_unnamed(&self) -> bool
pub fn is_unnamed(&self) -> bool
Whether the fields are unnamed.
Sourcepub fn names(&self) -> impl ExactSizeIterator<Item = &str>
pub fn names(&self) -> impl ExactSizeIterator<Item = &str>
Gets an iterator over the names of the fields.
If fields are unnamed, the field names will be f1, f2, etc.
Sourcepub fn types(&self) -> impl ExactSizeIterator<Item = &DataType>
pub fn types(&self) -> impl ExactSizeIterator<Item = &DataType>
Gets an iterator over the types of the fields.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = (&str, &DataType)>
pub fn iter(&self) -> impl ExactSizeIterator<Item = (&str, &DataType)>
Gets an iterator over the fields.
If fields are unnamed, the field names will be f1, f2, etc.
Sourcepub fn ids(&self) -> Option<impl ExactSizeIterator<Item = ColumnId> + '_>
pub fn ids(&self) -> Option<impl ExactSizeIterator<Item = ColumnId> + '_>
Gets an iterator over the field ids.
Returns None if they are not present. See documentation on the field field_ids
for the cases. For empty struct, this returns Some(<empty>).
Sourcepub fn id_at(&self, index: usize) -> Option<ColumnId>
pub fn id_at(&self, index: usize) -> Option<ColumnId>
Gets the field id at the given index.
Returns None if they are not present. See documentation on the field field_ids
for the cases.
Sourcepub fn ids_or_placeholder(&self) -> impl ExactSizeIterator<Item = ColumnId> + '_
pub fn ids_or_placeholder(&self) -> impl ExactSizeIterator<Item = ColumnId> + '_
Get an iterator over the field ids, or a sequence of placeholder ids if they are not present.
Sourcepub fn equals_datatype(&self, other: &StructType) -> bool
pub fn equals_datatype(&self, other: &StructType) -> bool
Compares the datatype with another, ignoring nested field names and ids.
Trait Implementations§
Source§impl Clone for StructType
impl Clone for StructType
Source§fn clone(&self) -> StructType
fn clone(&self) -> StructType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataTypes for StructType
impl DataTypes for StructType
Source§impl Debug for StructType
impl Debug for StructType
Source§impl Display for StructType
impl Display for StructType
Source§impl From<&StructType> for Schema
impl From<&StructType> for Schema
Source§fn from(t: &StructType) -> Self
fn from(t: &StructType) -> Self
Source§impl From<StructType> for DataType
impl From<StructType> for DataType
Source§fn from(value: StructType) -> Self
fn from(value: StructType) -> Self
Source§impl FromStr for StructType
impl FromStr for StructType
Source§impl Hash for StructType
impl Hash for StructType
Source§impl PartialEq for StructType
impl PartialEq for StructType
impl Eq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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>
T in a tonic::Request§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
Source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level.Source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n.Source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n with metric_level set to
MetricLevel::Debug and relabel_num set to 1.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SameOrElseExt for Twhere
T: Eq,
impl<T> SameOrElseExt for Twhere
T: Eq,
Source§fn same_or_else(self, other: T, f: impl FnOnce() -> T) -> T
fn same_or_else(self, other: T, f: impl FnOnce() -> T) -> T
self and other are equal, if so, return self, otherwise return the result of f().§impl<T> Scope for T
impl<T> Scope for T
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.