pub struct Value {
pub string_value: Option<String>,
pub float_value: Option<f32>,
pub double_value: Option<f64>,
pub int_value: Option<i64>,
pub uint_value: Option<u64>,
pub sint_value: Option<i64>,
pub bool_value: Option<bool>,
}Expand description
Variant type encoding The use of values is described in section 4.1 of the specification
Fields§
§string_value: Option<String>Exactly one of these values must be present in a valid message
Field 1: string_value
float_value: Option<f32>Field 2: float_value
double_value: Option<f64>Field 3: double_value
int_value: Option<i64>Field 4: int_value
uint_value: Option<u64>Field 5: uint_value
sint_value: Option<i64>Field 6: sint_value
bool_value: Option<bool>Field 7: bool_value
Implementations§
Source§impl Value
impl Value
Sourcepub fn with_string_value(self, value: impl Into<String>) -> Self
pub fn with_string_value(self, value: impl Into<String>) -> Self
Sets Self::string_value to Some(value), consuming and returning self.
Sourcepub fn with_float_value(self, value: f32) -> Self
pub fn with_float_value(self, value: f32) -> Self
Sets Self::float_value to Some(value), consuming and returning self.
Sourcepub fn with_double_value(self, value: f64) -> Self
pub fn with_double_value(self, value: f64) -> Self
Sets Self::double_value to Some(value), consuming and returning self.
Sourcepub fn with_int_value(self, value: i64) -> Self
pub fn with_int_value(self, value: i64) -> Self
Sets Self::int_value to Some(value), consuming and returning self.
Sourcepub fn with_uint_value(self, value: u64) -> Self
pub fn with_uint_value(self, value: u64) -> Self
Sets Self::uint_value to Some(value), consuming and returning self.
Sourcepub fn with_sint_value(self, value: i64) -> Self
pub fn with_sint_value(self, value: i64) -> Self
Sets Self::sint_value to Some(value), consuming and returning self.
Sourcepub fn with_bool_value(self, value: bool) -> Self
pub fn with_bool_value(self, value: bool) -> Self
Sets Self::bool_value to Some(value), consuming and returning self.
Trait Implementations§
Source§impl DefaultInstance for Value
impl DefaultInstance for Value
Source§fn default_instance() -> &'static Self
fn default_instance() -> &'static Self
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl HasMessageView for Value
impl HasMessageView for Value
Source§type View<'a> = ValueView<'a>
type View<'a> = ValueView<'a>
Self, borrowing from a buffer with lifetime
'a.Source§type ViewHandle = ValueOwnedView
type ViewHandle = ValueOwnedView
'static owned-view handle for Self
(FooOwnedView).Source§fn decode_view(buf: &[u8]) -> Result<Self::View<'_>, DecodeError>
fn decode_view(buf: &[u8]) -> Result<Self::View<'_>, DecodeError>
Source§fn decode_view_with_options<'a>(
buf: &'a [u8],
opts: &DecodeOptions,
) -> Result<Self::View<'a>, DecodeError>
fn decode_view_with_options<'a>( buf: &'a [u8], opts: &DecodeOptions, ) -> Result<Self::View<'a>, DecodeError>
View under custom
DecodeOptions (recursion limit, max message
size, unknown-field limit). Read moreSource§fn decode_view_handle(bytes: Bytes) -> Result<Self::ViewHandle, DecodeError>
fn decode_view_handle(bytes: Bytes) -> Result<Self::ViewHandle, DecodeError>
Source§fn decode_view_handle_with_options(
bytes: Bytes,
opts: &DecodeOptions,
) -> Result<Self::ViewHandle, DecodeError>
fn decode_view_handle_with_options( bytes: Bytes, opts: &DecodeOptions, ) -> Result<Self::ViewHandle, DecodeError>
Source§impl Message for Value
impl Message for Value
Source§fn compute_size(&self, _cache: &mut SizeCache) -> u32
fn compute_size(&self, _cache: &mut SizeCache) -> u32
Returns the total encoded size in bytes.
Accumulates in u64 (which cannot overflow for in-memory
data) and saturates to u32 at return, so a message whose
encoded size exceeds the 2 GiB protobuf limit yields a value
above ::buffa::MAX_MESSAGE_BYTES that the encode entry
points reject, never a silently wrapped size.
Source§fn write_to(&self, _cache: &mut SizeCache, buf: &mut impl EncodeSink)
fn write_to(&self, _cache: &mut SizeCache, buf: &mut impl EncodeSink)
cache (populated by a prior
compute_size call on the same cache). Read moreSource§fn merge_field(
&mut self,
tag: Tag,
buf: &mut impl Buf,
ctx: DecodeContext<'_>,
) -> Result<(), DecodeError>
fn merge_field( &mut self, tag: Tag, buf: &mut impl Buf, ctx: DecodeContext<'_>, ) -> Result<(), DecodeError>
buf. Read moreSource§fn encode(&self, buf: &mut impl EncodeSink)
fn encode(&self, buf: &mut impl EncodeSink)
Source§fn try_encode(&self, buf: &mut impl EncodeSink) -> Result<(), EncodeError>
fn try_encode(&self, buf: &mut impl EncodeSink) -> Result<(), EncodeError>
MAX_MESSAGE_BYTES). Read moreSource§fn encode_with_cache(&self, cache: &mut SizeCache, buf: &mut impl EncodeSink)
fn encode_with_cache(&self, cache: &mut SizeCache, buf: &mut impl EncodeSink)
Source§fn try_encode_with_cache(
&self,
cache: &mut SizeCache,
buf: &mut impl EncodeSink,
) -> Result<(), EncodeError>
fn try_encode_with_cache( &self, cache: &mut SizeCache, buf: &mut impl EncodeSink, ) -> Result<(), EncodeError>
SizeCache,
returning an error instead of panicking if the encoded size exceeds
the 2 GiB protobuf limit (MAX_MESSAGE_BYTES). Clears the cache
first. Read moreSource§fn try_encode_bounded(
&self,
max_bytes: u32,
buf: &mut impl EncodeSink,
) -> Result<u32, EncodeError>
fn try_encode_bounded( &self, max_bytes: u32, buf: &mut impl EncodeSink, ) -> Result<u32, EncodeError>
buf only if its encoded size fits within
max_bytes, using a single size pass that is then reused for the write. Read moreSource§fn try_encode_bounded_with_cache(
&self,
max_bytes: u32,
cache: &mut SizeCache,
buf: &mut impl EncodeSink,
) -> Result<u32, EncodeError>
fn try_encode_bounded_with_cache( &self, max_bytes: u32, cache: &mut SizeCache, buf: &mut impl EncodeSink, ) -> Result<u32, EncodeError>
Source§fn encoded_len(&self) -> u32
fn encoded_len(&self) -> u32
Source§fn try_encoded_len(&self) -> Result<u32, EncodeError>
fn try_encoded_len(&self) -> Result<u32, EncodeError>
MAX_MESSAGE_BYTES). Read moreSource§fn encode_length_delimited(&self, buf: &mut impl EncodeSink)
fn encode_length_delimited(&self, buf: &mut impl EncodeSink)
Source§fn try_encode_length_delimited(
&self,
buf: &mut impl EncodeSink,
) -> Result<(), EncodeError>
fn try_encode_length_delimited( &self, buf: &mut impl EncodeSink, ) -> Result<(), EncodeError>
MAX_MESSAGE_BYTES). Read moreSource§fn try_encode_to_vec(&self) -> Result<Vec<u8>, EncodeError>
fn try_encode_to_vec(&self) -> Result<Vec<u8>, EncodeError>
Vec<u8>, returning an error instead of panicking
if the encoded size exceeds the 2 GiB protobuf limit
(MAX_MESSAGE_BYTES). Read moreSource§fn encode_to_bytes(&self) -> Bytes
fn encode_to_bytes(&self) -> Bytes
bytes::Bytes. Read moreSource§fn try_encode_to_bytes(&self) -> Result<Bytes, EncodeError>
fn try_encode_to_bytes(&self) -> Result<Bytes, EncodeError>
bytes::Bytes, returning an error instead of
panicking if the encoded size exceeds the 2 GiB protobuf limit
(MAX_MESSAGE_BYTES). Read moreSource§fn decode(buf: &mut impl Buf) -> Result<Self, DecodeError>where
Self: Sized,
fn decode(buf: &mut impl Buf) -> Result<Self, DecodeError>where
Self: Sized,
Source§fn decode_from_slice(data: &[u8]) -> Result<Self, DecodeError>where
Self: Sized,
fn decode_from_slice(data: &[u8]) -> Result<Self, DecodeError>where
Self: Sized,
Source§fn decode_length_delimited(buf: &mut impl Buf) -> Result<Self, DecodeError>where
Self: Sized,
fn decode_length_delimited(buf: &mut impl Buf) -> Result<Self, DecodeError>where
Self: Sized,
Source§fn merge_to_limit(
&mut self,
buf: &mut impl Buf,
ctx: DecodeContext<'_>,
limit: usize,
) -> Result<(), DecodeError>
fn merge_to_limit( &mut self, buf: &mut impl Buf, ctx: DecodeContext<'_>, limit: usize, ) -> Result<(), DecodeError>
Source§fn merge_group(
&mut self,
buf: &mut impl Buf,
ctx: DecodeContext<'_>,
field_number: u32,
) -> Result<(), DecodeError>
fn merge_group( &mut self, buf: &mut impl Buf, ctx: DecodeContext<'_>, field_number: u32, ) -> Result<(), DecodeError>
buf, reading fields until an
EndGroup tag with the given field_number is encountered. Read moreSource§fn merge(
&mut self,
buf: &mut impl Buf,
ctx: DecodeContext<'_>,
) -> Result<(), DecodeError>
fn merge( &mut self, buf: &mut impl Buf, ctx: DecodeContext<'_>, ) -> Result<(), DecodeError>
Source§fn merge_from_slice(&mut self, data: &[u8]) -> Result<(), DecodeError>
fn merge_from_slice(&mut self, data: &[u8]) -> Result<(), DecodeError>
Source§fn merge_length_delimited(
&mut self,
buf: &mut impl Buf,
ctx: DecodeContext<'_>,
) -> Result<(), DecodeError>
fn merge_length_delimited( &mut self, buf: &mut impl Buf, ctx: DecodeContext<'_>, ) -> Result<(), DecodeError>
Source§impl MessageName for Value
impl MessageName for Value
Source§const PACKAGE: &'static str = "vector_tile"
const PACKAGE: &'static str = "vector_tile"
Source§const NAME: &'static str = "Tile.Value"
const NAME: &'static str = "Tile.Value"
. between nesting levels. Read moreSource§impl ProtoElemJson for Value
Available on crate feature json only.
impl ProtoElemJson for Value
json only.