pub struct VariantRef<'a> {
data: &'a [u8],
}Expand description
Borrowed value of the variant type.
Fields§
§data: &'a [u8]Implementations§
Source§impl<'a> VariantRef<'a>
impl<'a> VariantRef<'a>
Sourcepub fn as_bytes(&self) -> &'a [u8] ⓘ
pub fn as_bytes(&self) -> &'a [u8] ⓘ
Same bytes as Self::value_serialize, without the copy.
pub fn value_serialize(&self) -> Vec<u8> ⓘ
pub fn memcmp_serialize( &self, serializer: &mut Serializer<impl BufMut>, ) -> Result<()>
pub fn from_serialized(buf: &'a [u8]) -> Option<Self>
Sourcepub fn from_serialized_unchecked(buf: &'a [u8]) -> Self
pub fn from_serialized_unchecked(buf: &'a [u8]) -> Self
Wraps bytes already validated by Self::from_serialized, such as a slot of a
VariantArray, which validates on the way in.
pub fn metadata(&self) -> &'a [u8] ⓘ
pub fn value(&self) -> &'a [u8] ⓘ
pub fn parquet_variant(&self) -> ParquetVariant<'a, 'a>
pub fn is_variant_null(&self) -> bool
pub fn is_array(&self) -> bool
pub fn is_object(&self) -> bool
pub fn type_name(&self) -> &'static str
pub fn access_path(self, path: &str) -> Option<VariantVal>
pub fn access_path_strict(self, path: &str) -> Result<Option<VariantVal>>
pub fn to_jsonb(self) -> Result<JsonbVal>
Trait Implementations§
Source§impl<'a> Clone for VariantRef<'a>
impl<'a> Clone for VariantRef<'a>
Source§fn clone(&self) -> VariantRef<'a>
fn clone(&self) -> VariantRef<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for VariantRef<'a>
Source§impl<'a> Debug for VariantRef<'a>
impl<'a> Debug for VariantRef<'a>
Source§impl Display for VariantRef<'_>
impl Display for VariantRef<'_>
impl Eq for VariantRef<'_>
Source§impl From<VariantRef<'_>> for VariantVal
impl From<VariantRef<'_>> for VariantVal
Source§fn from(value: VariantRef<'_>) -> Self
fn from(value: VariantRef<'_>) -> Self
Converts to this type from the input type.
Source§impl From<VariantRef<'_>> for ScalarImpl
impl From<VariantRef<'_>> for ScalarImpl
Source§fn from(variant: VariantRef<'_>) -> Self
fn from(variant: VariantRef<'_>) -> Self
Converts to this type from the input type.
Source§impl<'scalar> From<VariantRef<'scalar>> for ScalarRefImpl<'scalar>
impl<'scalar> From<VariantRef<'scalar>> for ScalarRefImpl<'scalar>
Source§fn from(val: VariantRef<'scalar>) -> Self
fn from(val: VariantRef<'scalar>) -> Self
Converts to this type from the input type.
Source§impl Hash for VariantRef<'_>
impl Hash for VariantRef<'_>
Source§impl Ord for VariantRef<'_>
impl Ord for VariantRef<'_>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for VariantRef<'_>
impl PartialEq for VariantRef<'_>
Source§impl PartialOrd for VariantRef<'_>
impl PartialOrd for VariantRef<'_>
Source§impl<'a> ScalarRef<'a> for VariantRef<'a>
impl<'a> ScalarRef<'a> for VariantRef<'a>
Source§type ScalarType = VariantVal
type ScalarType = VariantVal
ScalarType is the owned type of current ScalarRef.Source§fn to_owned_scalar(&self) -> Self::ScalarType
fn to_owned_scalar(&self) -> Self::ScalarType
Convert
ScalarRef to an owned scalar.Source§fn hash_scalar<H: Hasher>(&self, state: &mut H)
fn hash_scalar<H: Hasher>(&self, state: &mut H)
A wrapped hash function to get the hash value for this scaler.
Source§impl SelfAsScalarRef for VariantRef<'_>
impl SelfAsScalarRef for VariantRef<'_>
fn as_scalar_ref(&self) -> Self
Source§impl ToBinary for VariantRef<'_>
impl ToBinary for VariantRef<'_>
fn to_binary_with_type(&self, _ty: &DataType) -> Result<Bytes, ToBinaryError>
Source§impl ToSql for VariantRef<'_>
impl ToSql for VariantRef<'_>
Source§fn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Determines if a value of this type can be converted to the specified
Postgres
Type.Source§fn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
An adaptor method used internally by Rust-Postgres. Read more
Source§fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
Converts the value of
self into the binary format of the specified
Postgres Type, appending it to out. Read more§fn encode_format(&self, _ty: &Type) -> Format
fn encode_format(&self, _ty: &Type) -> Format
Specify the encode format
Source§impl ToText for VariantRef<'_>
impl ToText for VariantRef<'_>
Source§fn write<W: Write>(&self, f: &mut W) -> Result
fn write<W: Write>(&self, f: &mut W) -> Result
Write the text to the writer regardless of its data type Read more
Source§fn write_with_type<W: Write>(&self, _ty: &DataType, f: &mut W) -> Result
fn write_with_type<W: Write>(&self, _ty: &DataType, f: &mut W) -> Result
Write the text to the writer according to its data type
Source§fn to_text_with_type(&self, ty: &DataType) -> String
fn to_text_with_type(&self, ty: &DataType) -> String
Convert to text according to its data type
Source§fn to_text(&self) -> String
fn to_text(&self) -> String
to_text is a special version of to_text_with_type, it convert the scalar to default type
text. E.g. for Int64, it will convert to text as a Int64 type.
We should prefer to use to_text_with_type because it’s more clear and readable. Read moreSource§fn text_display(&self) -> impl Display + '_
fn text_display(&self) -> impl Display + '_
Returns an displayable wrapper implemented with
ToText::write.Source§impl<'scalar> TryFrom<ScalarRefImpl<'scalar>> for VariantRef<'scalar>
impl<'scalar> TryFrom<ScalarRefImpl<'scalar>> for VariantRef<'scalar>
Source§type Error = ArrayError
type Error = ArrayError
The type returned in the event of a conversion error.
Source§fn try_from(val: ScalarRefImpl<'scalar>) -> ArrayResult<Self>
fn try_from(val: ScalarRefImpl<'scalar>) -> ArrayResult<Self>
Performs the conversion.
Source§impl WithDataType for VariantRef<'_>
impl WithDataType for VariantRef<'_>
Source§fn default_data_type() -> DataType
fn default_data_type() -> DataType
Returns the most obvious
DataType for the rust type.Auto Trait Implementations§
impl<'a> Freeze for VariantRef<'a>
impl<'a> RefUnwindSafe for VariantRef<'a>
impl<'a> Send for VariantRef<'a>
impl<'a> Sync for VariantRef<'a>
impl<'a> Unpin for VariantRef<'a>
impl<'a> UnsafeUnpin for VariantRef<'a>
impl<'a> UnwindSafe for VariantRef<'a>
Blanket Implementations§
impl<T> Allocation for T
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
fn as_<T>(self) -> Twhere
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 moreSource§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
§impl<T> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
§fn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to
self as a ToSql trait object.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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,
Forward to the method defined on the type
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,
Forward to the method defined on the type
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
Compare self to
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
Checks if this value is equivalent to the given key. Read more
§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>
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
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>
impl<T> Key for T
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].impl<T> LruKey for T
impl<T> LruValue for T
impl<T> MaybeSend for Twhere
T: Send,
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>
Equivalent to
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>
Equivalent to
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>
Equivalent to
RelabeledMetricVec::with_metric_level_relabel_n with metric_level set to
MetricLevel::Debug and relabel_num set to 1.impl<N> NodeTrait for N
§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
Check if
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
Source§impl<T> ToOwnedDatum for Twhere
T: Into<ScalarImpl>,
impl<T> ToOwnedDatum for Twhere
T: Into<ScalarImpl>,
Source§fn to_owned_datum(self) -> Option<ScalarImpl>
fn to_owned_datum(self) -> Option<ScalarImpl>
Convert the datum to an owned
Datum.§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.