#[derive(Clone, Debug, Default)]
pub struct FileView<'a> {
pub name: &'a str,
pub contents: &'a [u8],
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for FileView<'a> {
type Owned = super::super::File;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.contents = ::buffa::types::borrow_bytes(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::File, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::File, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::File {
name: self.name.to_string(),
contents: (self.contents).to_vec(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for FileView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
if !self.contents.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.contents) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
if !self.contents.is_empty() {
::buffa::types::put_shared_bytes_field(2u32, &self.contents, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for FileView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "File";
const FULL_NAME: &'static str = "plugin.File";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.File";
}
::buffa::impl_default_view_instance!(FileView);
::buffa::impl_view_reborrow!(FileView);
#[derive(Clone, Debug)]
pub struct FileOwnedView(::buffa::OwnedView<FileView<'static>>);
impl FileOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(FileOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
FileOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::File,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(FileOwnedView(::buffa::OwnedView::from_owned(msg)?))
}
#[must_use]
pub fn view(&self) -> &FileView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::File {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
#[must_use]
pub fn contents(&self) -> &'_ [u8] {
self.0.reborrow().contents
}
}
impl ::core::convert::From<::buffa::OwnedView<FileView<'static>>> for FileOwnedView {
fn from(inner: ::buffa::OwnedView<FileView<'static>>) -> Self {
FileOwnedView(inner)
}
}
impl ::core::convert::From<FileOwnedView> for ::buffa::OwnedView<FileView<'static>> {
fn from(wrapper: FileOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<FileView<'static>>> for FileOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<FileView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::File {
type View<'a> = FileView<'a>;
type ViewHandle = FileOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct SettingsView<'a> {
pub version: &'a str,
pub engine: &'a str,
pub schema: ::buffa::RepeatedView<'a, &'a str>,
pub queries: ::buffa::RepeatedView<'a, &'a str>,
pub codegen: ::buffa::MessageFieldView<super::super::__buffa::view::CodegenView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for SettingsView<'a> {
type Owned = super::super::Settings;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.version = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.engine = ::buffa::types::borrow_str(&mut cur)?;
}
12u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.codegen.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.codegen = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::CodegenView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __elem = ::buffa::types::borrow_str(&mut cur)?;
ctx.register_element_memory(
::buffa::__private::element_footprint(&__elem),
)?;
view.schema.push(__elem);
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __elem = ::buffa::types::borrow_str(&mut cur)?;
ctx.register_element_memory(
::buffa::__private::element_footprint(&__elem),
)?;
view.queries.push(__elem);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Settings, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Settings, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Settings {
version: self.version.to_string(),
engine: self.engine.to_string(),
schema: self.schema.iter().map(|s| s.to_string()).collect(),
queries: self.queries.iter().map(|s| s.to_string()).collect(),
codegen: match self.codegen.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Codegen,
::buffa::Inline<super::super::Codegen>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for SettingsView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.version.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.version) as u64;
}
if !self.engine.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.engine) as u64;
}
for v in &self.schema {
size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
}
for v in &self.queries {
size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
}
if self.codegen.is_set() {
let __slot = __cache.reserve();
let inner_size = self.codegen.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.version.is_empty() {
::buffa::types::put_string_field(1u32, &self.version, buf);
}
if !self.engine.is_empty() {
::buffa::types::put_string_field(2u32, &self.engine, buf);
}
for v in &self.schema {
::buffa::types::put_string_field(3u32, v, buf);
}
for v in &self.queries {
::buffa::types::put_string_field(4u32, v, buf);
}
if self.codegen.is_set() {
::buffa::types::put_len_delimited_header(
12u32,
u64::from(__cache.consume_next()),
buf,
);
self.codegen.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for SettingsView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Settings";
const FULL_NAME: &'static str = "plugin.Settings";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Settings";
}
::buffa::impl_default_view_instance!(SettingsView);
::buffa::impl_view_reborrow!(SettingsView);
#[derive(Clone, Debug)]
pub struct SettingsOwnedView(::buffa::OwnedView<SettingsView<'static>>);
impl SettingsOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(SettingsOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
SettingsOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Settings,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
SettingsOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &SettingsView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Settings {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn version(&self) -> &'_ str {
self.0.reborrow().version
}
#[must_use]
pub fn engine(&self) -> &'_ str {
self.0.reborrow().engine
}
#[must_use]
pub fn schema(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
&self.0.reborrow().schema
}
#[must_use]
pub fn queries(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
&self.0.reborrow().queries
}
#[must_use]
pub fn codegen(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::CodegenView<'_>> {
&self.0.reborrow().codegen
}
}
impl ::core::convert::From<::buffa::OwnedView<SettingsView<'static>>>
for SettingsOwnedView {
fn from(inner: ::buffa::OwnedView<SettingsView<'static>>) -> Self {
SettingsOwnedView(inner)
}
}
impl ::core::convert::From<SettingsOwnedView>
for ::buffa::OwnedView<SettingsView<'static>> {
fn from(wrapper: SettingsOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<SettingsView<'static>>>
for SettingsOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<SettingsView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Settings {
type View<'a> = SettingsView<'a>;
type ViewHandle = SettingsOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct CodegenView<'a> {
pub out: &'a str,
pub plugin: &'a str,
pub options: &'a [u8],
pub env: ::buffa::RepeatedView<'a, &'a str>,
pub process: ::buffa::MessageFieldView<
super::super::__buffa::view::codegen::ProcessView<'a>,
>,
pub wasm: ::buffa::MessageFieldView<
super::super::__buffa::view::codegen::WASMView<'a>,
>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for CodegenView<'a> {
type Owned = super::super::Codegen;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.out = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.plugin = ::buffa::types::borrow_str(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.options = ::buffa::types::borrow_bytes(&mut cur)?;
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.process.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.process = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::codegen::ProcessView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.wasm.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.wasm = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::codegen::WASMView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __elem = ::buffa::types::borrow_str(&mut cur)?;
ctx.register_element_memory(
::buffa::__private::element_footprint(&__elem),
)?;
view.env.push(__elem);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Codegen, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Codegen, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Codegen {
out: self.out.to_string(),
plugin: self.plugin.to_string(),
options: (self.options).to_vec(),
env: self.env.iter().map(|s| s.to_string()).collect(),
process: match self.process.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::codegen::Process,
::buffa::Inline<super::super::codegen::Process>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
wasm: match self.wasm.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::codegen::WASM,
::buffa::Inline<super::super::codegen::WASM>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for CodegenView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.out.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.out) as u64;
}
if !self.plugin.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.plugin) as u64;
}
if !self.options.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.options) as u64;
}
for v in &self.env {
size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
}
if self.process.is_set() {
let __slot = __cache.reserve();
let inner_size = self.process.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if self.wasm.is_set() {
let __slot = __cache.reserve();
let inner_size = self.wasm.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.out.is_empty() {
::buffa::types::put_string_field(1u32, &self.out, buf);
}
if !self.plugin.is_empty() {
::buffa::types::put_string_field(2u32, &self.plugin, buf);
}
if !self.options.is_empty() {
::buffa::types::put_shared_bytes_field(3u32, &self.options, buf);
}
for v in &self.env {
::buffa::types::put_string_field(4u32, v, buf);
}
if self.process.is_set() {
::buffa::types::put_len_delimited_header(
5u32,
u64::from(__cache.consume_next()),
buf,
);
self.process.write_to(__cache, buf);
}
if self.wasm.is_set() {
::buffa::types::put_len_delimited_header(
6u32,
u64::from(__cache.consume_next()),
buf,
);
self.wasm.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for CodegenView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Codegen";
const FULL_NAME: &'static str = "plugin.Codegen";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Codegen";
}
::buffa::impl_default_view_instance!(CodegenView);
::buffa::impl_view_reborrow!(CodegenView);
#[derive(Clone, Debug)]
pub struct CodegenOwnedView(::buffa::OwnedView<CodegenView<'static>>);
impl CodegenOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(CodegenOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CodegenOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Codegen,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CodegenOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &CodegenView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Codegen {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn out(&self) -> &'_ str {
self.0.reborrow().out
}
#[must_use]
pub fn plugin(&self) -> &'_ str {
self.0.reborrow().plugin
}
#[must_use]
pub fn options(&self) -> &'_ [u8] {
self.0.reborrow().options
}
#[must_use]
pub fn env(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
&self.0.reborrow().env
}
#[must_use]
pub fn process(
&self,
) -> &::buffa::MessageFieldView<
super::super::__buffa::view::codegen::ProcessView<'_>,
> {
&self.0.reborrow().process
}
#[must_use]
pub fn wasm(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::codegen::WASMView<'_>> {
&self.0.reborrow().wasm
}
}
impl ::core::convert::From<::buffa::OwnedView<CodegenView<'static>>>
for CodegenOwnedView {
fn from(inner: ::buffa::OwnedView<CodegenView<'static>>) -> Self {
CodegenOwnedView(inner)
}
}
impl ::core::convert::From<CodegenOwnedView>
for ::buffa::OwnedView<CodegenView<'static>> {
fn from(wrapper: CodegenOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<CodegenView<'static>>>
for CodegenOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<CodegenView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Codegen {
type View<'a> = CodegenView<'a>;
type ViewHandle = CodegenOwnedView;
}
pub mod codegen {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, Default)]
pub struct ProcessView<'a> {
pub cmd: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for ProcessView<'a> {
type Owned = super::super::super::codegen::Process;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.cmd = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::super::codegen::Process,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::super::codegen::Process,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::super::codegen::Process {
cmd: self.cmd.to_string(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for ProcessView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.cmd.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.cmd) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.cmd.is_empty() {
::buffa::types::put_string_field(1u32, &self.cmd, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for ProcessView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Codegen.Process";
const FULL_NAME: &'static str = "plugin.Codegen.Process";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Codegen.Process";
}
::buffa::impl_default_view_instance!(ProcessView);
::buffa::impl_view_reborrow!(ProcessView);
#[derive(Clone, Debug)]
pub struct ProcessOwnedView(::buffa::OwnedView<ProcessView<'static>>);
impl ProcessOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ProcessOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ProcessOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::super::codegen::Process,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ProcessOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &ProcessView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::super::codegen::Process {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn cmd(&self) -> &'_ str {
self.0.reborrow().cmd
}
}
impl ::core::convert::From<::buffa::OwnedView<ProcessView<'static>>>
for ProcessOwnedView {
fn from(inner: ::buffa::OwnedView<ProcessView<'static>>) -> Self {
ProcessOwnedView(inner)
}
}
impl ::core::convert::From<ProcessOwnedView>
for ::buffa::OwnedView<ProcessView<'static>> {
fn from(wrapper: ProcessOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<ProcessView<'static>>>
for ProcessOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<ProcessView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::super::codegen::Process {
type View<'a> = ProcessView<'a>;
type ViewHandle = ProcessOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct WASMView<'a> {
pub url: &'a str,
pub sha256: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for WASMView<'a> {
type Owned = super::super::super::codegen::WASM;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.url = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.sha256 = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::super::codegen::WASM,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::super::codegen::WASM,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::super::codegen::WASM {
url: self.url.to_string(),
sha256: self.sha256.to_string(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for WASMView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.url.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.url) as u64;
}
if !self.sha256.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.sha256) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.url.is_empty() {
::buffa::types::put_string_field(1u32, &self.url, buf);
}
if !self.sha256.is_empty() {
::buffa::types::put_string_field(2u32, &self.sha256, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for WASMView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Codegen.WASM";
const FULL_NAME: &'static str = "plugin.Codegen.WASM";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Codegen.WASM";
}
::buffa::impl_default_view_instance!(WASMView);
::buffa::impl_view_reborrow!(WASMView);
#[derive(Clone, Debug)]
pub struct WASMOwnedView(::buffa::OwnedView<WASMView<'static>>);
impl WASMOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(WASMOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
WASMOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::super::codegen::WASM,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
WASMOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &WASMView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::super::codegen::WASM {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn url(&self) -> &'_ str {
self.0.reborrow().url
}
#[must_use]
pub fn sha256(&self) -> &'_ str {
self.0.reborrow().sha256
}
}
impl ::core::convert::From<::buffa::OwnedView<WASMView<'static>>> for WASMOwnedView {
fn from(inner: ::buffa::OwnedView<WASMView<'static>>) -> Self {
WASMOwnedView(inner)
}
}
impl ::core::convert::From<WASMOwnedView> for ::buffa::OwnedView<WASMView<'static>> {
fn from(wrapper: WASMOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<WASMView<'static>>>
for WASMOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<WASMView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::super::codegen::WASM {
type View<'a> = WASMView<'a>;
type ViewHandle = WASMOwnedView;
}
}
#[derive(Clone, Debug, Default)]
pub struct CatalogView<'a> {
pub comment: &'a str,
pub default_schema: &'a str,
pub name: &'a str,
pub schemas: ::buffa::RepeatedView<'a, super::super::__buffa::view::SchemaView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for CatalogView<'a> {
type Owned = super::super::Catalog;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.comment = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.default_schema = ::buffa::types::borrow_str(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::SchemaView>(),
)?;
view.schemas
.push(
<super::super::__buffa::view::SchemaView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Catalog, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Catalog, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Catalog {
comment: self.comment.to_string(),
default_schema: self.default_schema.to_string(),
name: self.name.to_string(),
schemas: self
.schemas
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for CatalogView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.comment.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.comment) as u64;
}
if !self.default_schema.is_empty() {
size
+= 1u64
+ ::buffa::types::string_encoded_len(&self.default_schema) as u64;
}
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
for v in &self.schemas {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.comment.is_empty() {
::buffa::types::put_string_field(1u32, &self.comment, buf);
}
if !self.default_schema.is_empty() {
::buffa::types::put_string_field(2u32, &self.default_schema, buf);
}
if !self.name.is_empty() {
::buffa::types::put_string_field(3u32, &self.name, buf);
}
for v in &self.schemas {
::buffa::types::put_len_delimited_header(
4u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for CatalogView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Catalog";
const FULL_NAME: &'static str = "plugin.Catalog";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Catalog";
}
::buffa::impl_default_view_instance!(CatalogView);
::buffa::impl_view_reborrow!(CatalogView);
#[derive(Clone, Debug)]
pub struct CatalogOwnedView(::buffa::OwnedView<CatalogView<'static>>);
impl CatalogOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(CatalogOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CatalogOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Catalog,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CatalogOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &CatalogView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Catalog {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn comment(&self) -> &'_ str {
self.0.reborrow().comment
}
#[must_use]
pub fn default_schema(&self) -> &'_ str {
self.0.reborrow().default_schema
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
#[must_use]
pub fn schemas(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::SchemaView<'_>> {
&self.0.reborrow().schemas
}
}
impl ::core::convert::From<::buffa::OwnedView<CatalogView<'static>>>
for CatalogOwnedView {
fn from(inner: ::buffa::OwnedView<CatalogView<'static>>) -> Self {
CatalogOwnedView(inner)
}
}
impl ::core::convert::From<CatalogOwnedView>
for ::buffa::OwnedView<CatalogView<'static>> {
fn from(wrapper: CatalogOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<CatalogView<'static>>>
for CatalogOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<CatalogView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Catalog {
type View<'a> = CatalogView<'a>;
type ViewHandle = CatalogOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct SchemaView<'a> {
pub comment: &'a str,
pub name: &'a str,
pub tables: ::buffa::RepeatedView<'a, super::super::__buffa::view::TableView<'a>>,
pub enums: ::buffa::RepeatedView<'a, super::super::__buffa::view::EnumView<'a>>,
pub composite_types: ::buffa::RepeatedView<
'a,
super::super::__buffa::view::CompositeTypeView<'a>,
>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for SchemaView<'a> {
type Owned = super::super::Schema;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.comment = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::TableView>(),
)?;
view.tables
.push(
<super::super::__buffa::view::TableView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::EnumView>(),
)?;
view.enums
.push(
<super::super::__buffa::view::EnumView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<
super::super::__buffa::view::CompositeTypeView,
>(),
)?;
view.composite_types
.push(
<super::super::__buffa::view::CompositeTypeView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Schema, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Schema, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Schema {
comment: self.comment.to_string(),
name: self.name.to_string(),
tables: self
.tables
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
enums: self
.enums
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
composite_types: self
.composite_types
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for SchemaView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.comment.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.comment) as u64;
}
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
for v in &self.tables {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.enums {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.composite_types {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.comment.is_empty() {
::buffa::types::put_string_field(1u32, &self.comment, buf);
}
if !self.name.is_empty() {
::buffa::types::put_string_field(2u32, &self.name, buf);
}
for v in &self.tables {
::buffa::types::put_len_delimited_header(
3u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
for v in &self.enums {
::buffa::types::put_len_delimited_header(
4u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
for v in &self.composite_types {
::buffa::types::put_len_delimited_header(
5u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for SchemaView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Schema";
const FULL_NAME: &'static str = "plugin.Schema";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Schema";
}
::buffa::impl_default_view_instance!(SchemaView);
::buffa::impl_view_reborrow!(SchemaView);
#[derive(Clone, Debug)]
pub struct SchemaOwnedView(::buffa::OwnedView<SchemaView<'static>>);
impl SchemaOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(SchemaOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
SchemaOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Schema,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(SchemaOwnedView(::buffa::OwnedView::from_owned(msg)?))
}
#[must_use]
pub fn view(&self) -> &SchemaView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Schema {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn comment(&self) -> &'_ str {
self.0.reborrow().comment
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
#[must_use]
pub fn tables(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::TableView<'_>> {
&self.0.reborrow().tables
}
#[must_use]
pub fn enums(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::EnumView<'_>> {
&self.0.reborrow().enums
}
#[must_use]
pub fn composite_types(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::CompositeTypeView<'_>> {
&self.0.reborrow().composite_types
}
}
impl ::core::convert::From<::buffa::OwnedView<SchemaView<'static>>> for SchemaOwnedView {
fn from(inner: ::buffa::OwnedView<SchemaView<'static>>) -> Self {
SchemaOwnedView(inner)
}
}
impl ::core::convert::From<SchemaOwnedView> for ::buffa::OwnedView<SchemaView<'static>> {
fn from(wrapper: SchemaOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<SchemaView<'static>>>
for SchemaOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<SchemaView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Schema {
type View<'a> = SchemaView<'a>;
type ViewHandle = SchemaOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct CompositeTypeView<'a> {
pub name: &'a str,
pub comment: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for CompositeTypeView<'a> {
type Owned = super::super::CompositeType;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.comment = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::CompositeType, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::CompositeType, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::CompositeType {
name: self.name.to_string(),
comment: self.comment.to_string(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for CompositeTypeView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
if !self.comment.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.comment) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
if !self.comment.is_empty() {
::buffa::types::put_string_field(2u32, &self.comment, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for CompositeTypeView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "CompositeType";
const FULL_NAME: &'static str = "plugin.CompositeType";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.CompositeType";
}
::buffa::impl_default_view_instance!(CompositeTypeView);
::buffa::impl_view_reborrow!(CompositeTypeView);
#[derive(Clone, Debug)]
pub struct CompositeTypeOwnedView(::buffa::OwnedView<CompositeTypeView<'static>>);
impl CompositeTypeOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CompositeTypeOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CompositeTypeOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::CompositeType,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CompositeTypeOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &CompositeTypeView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::CompositeType {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
#[must_use]
pub fn comment(&self) -> &'_ str {
self.0.reborrow().comment
}
}
impl ::core::convert::From<::buffa::OwnedView<CompositeTypeView<'static>>>
for CompositeTypeOwnedView {
fn from(inner: ::buffa::OwnedView<CompositeTypeView<'static>>) -> Self {
CompositeTypeOwnedView(inner)
}
}
impl ::core::convert::From<CompositeTypeOwnedView>
for ::buffa::OwnedView<CompositeTypeView<'static>> {
fn from(wrapper: CompositeTypeOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<CompositeTypeView<'static>>>
for CompositeTypeOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<CompositeTypeView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::CompositeType {
type View<'a> = CompositeTypeView<'a>;
type ViewHandle = CompositeTypeOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct EnumView<'a> {
pub name: &'a str,
pub vals: ::buffa::RepeatedView<'a, &'a str>,
pub comment: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for EnumView<'a> {
type Owned = super::super::Enum;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.comment = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __elem = ::buffa::types::borrow_str(&mut cur)?;
ctx.register_element_memory(
::buffa::__private::element_footprint(&__elem),
)?;
view.vals.push(__elem);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Enum, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Enum, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Enum {
name: self.name.to_string(),
vals: self.vals.iter().map(|s| s.to_string()).collect(),
comment: self.comment.to_string(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for EnumView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
for v in &self.vals {
size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
}
if !self.comment.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.comment) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
for v in &self.vals {
::buffa::types::put_string_field(2u32, v, buf);
}
if !self.comment.is_empty() {
::buffa::types::put_string_field(3u32, &self.comment, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for EnumView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Enum";
const FULL_NAME: &'static str = "plugin.Enum";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Enum";
}
::buffa::impl_default_view_instance!(EnumView);
::buffa::impl_view_reborrow!(EnumView);
#[derive(Clone, Debug)]
pub struct EnumOwnedView(::buffa::OwnedView<EnumView<'static>>);
impl EnumOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(EnumOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
EnumOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Enum,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(EnumOwnedView(::buffa::OwnedView::from_owned(msg)?))
}
#[must_use]
pub fn view(&self) -> &EnumView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Enum {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
#[must_use]
pub fn vals(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
&self.0.reborrow().vals
}
#[must_use]
pub fn comment(&self) -> &'_ str {
self.0.reborrow().comment
}
}
impl ::core::convert::From<::buffa::OwnedView<EnumView<'static>>> for EnumOwnedView {
fn from(inner: ::buffa::OwnedView<EnumView<'static>>) -> Self {
EnumOwnedView(inner)
}
}
impl ::core::convert::From<EnumOwnedView> for ::buffa::OwnedView<EnumView<'static>> {
fn from(wrapper: EnumOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<EnumView<'static>>> for EnumOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<EnumView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Enum {
type View<'a> = EnumView<'a>;
type ViewHandle = EnumOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct TableView<'a> {
pub rel: ::buffa::MessageFieldView<super::super::__buffa::view::IdentifierView<'a>>,
pub columns: ::buffa::RepeatedView<'a, super::super::__buffa::view::ColumnView<'a>>,
pub comment: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for TableView<'a> {
type Owned = super::super::Table;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.rel.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.rel = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::IdentifierView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.comment = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::ColumnView>(),
)?;
view.columns
.push(
<super::super::__buffa::view::ColumnView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Table, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Table, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Table {
rel: match self.rel.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Identifier,
::buffa::Inline<super::super::Identifier>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
columns: self
.columns
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
comment: self.comment.to_string(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for TableView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if self.rel.is_set() {
let __slot = __cache.reserve();
let inner_size = self.rel.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.columns {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if !self.comment.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.comment) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.rel.is_set() {
::buffa::types::put_len_delimited_header(
1u32,
u64::from(__cache.consume_next()),
buf,
);
self.rel.write_to(__cache, buf);
}
for v in &self.columns {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
if !self.comment.is_empty() {
::buffa::types::put_string_field(3u32, &self.comment, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for TableView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Table";
const FULL_NAME: &'static str = "plugin.Table";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Table";
}
::buffa::impl_default_view_instance!(TableView);
::buffa::impl_view_reborrow!(TableView);
#[derive(Clone, Debug)]
pub struct TableOwnedView(::buffa::OwnedView<TableView<'static>>);
impl TableOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(TableOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
TableOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Table,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(TableOwnedView(::buffa::OwnedView::from_owned(msg)?))
}
#[must_use]
pub fn view(&self) -> &TableView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Table {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn rel(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::IdentifierView<'_>> {
&self.0.reborrow().rel
}
#[must_use]
pub fn columns(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::ColumnView<'_>> {
&self.0.reborrow().columns
}
#[must_use]
pub fn comment(&self) -> &'_ str {
self.0.reborrow().comment
}
}
impl ::core::convert::From<::buffa::OwnedView<TableView<'static>>> for TableOwnedView {
fn from(inner: ::buffa::OwnedView<TableView<'static>>) -> Self {
TableOwnedView(inner)
}
}
impl ::core::convert::From<TableOwnedView> for ::buffa::OwnedView<TableView<'static>> {
fn from(wrapper: TableOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<TableView<'static>>> for TableOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<TableView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Table {
type View<'a> = TableView<'a>;
type ViewHandle = TableOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct IdentifierView<'a> {
pub catalog: &'a str,
pub schema: &'a str,
pub name: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for IdentifierView<'a> {
type Owned = super::super::Identifier;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.catalog = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.schema = ::buffa::types::borrow_str(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Identifier, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Identifier, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Identifier {
catalog: self.catalog.to_string(),
schema: self.schema.to_string(),
name: self.name.to_string(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for IdentifierView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.catalog.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.catalog) as u64;
}
if !self.schema.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.schema) as u64;
}
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.catalog.is_empty() {
::buffa::types::put_string_field(1u32, &self.catalog, buf);
}
if !self.schema.is_empty() {
::buffa::types::put_string_field(2u32, &self.schema, buf);
}
if !self.name.is_empty() {
::buffa::types::put_string_field(3u32, &self.name, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for IdentifierView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Identifier";
const FULL_NAME: &'static str = "plugin.Identifier";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Identifier";
}
::buffa::impl_default_view_instance!(IdentifierView);
::buffa::impl_view_reborrow!(IdentifierView);
#[derive(Clone, Debug)]
pub struct IdentifierOwnedView(::buffa::OwnedView<IdentifierView<'static>>);
impl IdentifierOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
IdentifierOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
IdentifierOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Identifier,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
IdentifierOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &IdentifierView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Identifier {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn catalog(&self) -> &'_ str {
self.0.reborrow().catalog
}
#[must_use]
pub fn schema(&self) -> &'_ str {
self.0.reborrow().schema
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
}
impl ::core::convert::From<::buffa::OwnedView<IdentifierView<'static>>>
for IdentifierOwnedView {
fn from(inner: ::buffa::OwnedView<IdentifierView<'static>>) -> Self {
IdentifierOwnedView(inner)
}
}
impl ::core::convert::From<IdentifierOwnedView>
for ::buffa::OwnedView<IdentifierView<'static>> {
fn from(wrapper: IdentifierOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<IdentifierView<'static>>>
for IdentifierOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<IdentifierView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Identifier {
type View<'a> = IdentifierView<'a>;
type ViewHandle = IdentifierOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct ColumnView<'a> {
pub name: &'a str,
pub not_null: bool,
pub is_array: bool,
pub comment: &'a str,
pub length: i32,
pub is_named_param: bool,
pub is_func_call: bool,
pub scope: &'a str,
pub table: ::buffa::MessageFieldView<
super::super::__buffa::view::IdentifierView<'a>,
>,
pub table_alias: &'a str,
pub r#type: ::buffa::MessageFieldView<
super::super::__buffa::view::IdentifierView<'a>,
>,
pub is_sqlc_slice: bool,
pub embed_table: ::buffa::MessageFieldView<
super::super::__buffa::view::IdentifierView<'a>,
>,
pub original_name: &'a str,
pub unsigned: bool,
pub array_dims: i32,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for ColumnView<'a> {
type Owned = super::super::Column;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.not_null = ::buffa::types::decode_bool(&mut cur)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.is_array = ::buffa::types::decode_bool(&mut cur)?;
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.comment = ::buffa::types::borrow_str(&mut cur)?;
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.length = ::buffa::types::decode_int32(&mut cur)?;
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.is_named_param = ::buffa::types::decode_bool(&mut cur)?;
}
8u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.is_func_call = ::buffa::types::decode_bool(&mut cur)?;
}
9u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.scope = ::buffa::types::borrow_str(&mut cur)?;
}
10u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.table.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.table = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::IdentifierView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
11u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.table_alias = ::buffa::types::borrow_str(&mut cur)?;
}
12u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.r#type.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.r#type = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::IdentifierView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
13u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.is_sqlc_slice = ::buffa::types::decode_bool(&mut cur)?;
}
14u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.embed_table.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.embed_table = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::IdentifierView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
15u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.original_name = ::buffa::types::borrow_str(&mut cur)?;
}
16u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.unsigned = ::buffa::types::decode_bool(&mut cur)?;
}
17u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.array_dims = ::buffa::types::decode_int32(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Column, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Column, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Column {
name: self.name.to_string(),
not_null: self.not_null,
is_array: self.is_array,
comment: self.comment.to_string(),
length: self.length,
is_named_param: self.is_named_param,
is_func_call: self.is_func_call,
scope: self.scope.to_string(),
table: match self.table.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Identifier,
::buffa::Inline<super::super::Identifier>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
table_alias: self.table_alias.to_string(),
r#type: match self.r#type.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Identifier,
::buffa::Inline<super::super::Identifier>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
is_sqlc_slice: self.is_sqlc_slice,
embed_table: match self.embed_table.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Identifier,
::buffa::Inline<super::super::Identifier>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
original_name: self.original_name.to_string(),
unsigned: self.unsigned,
array_dims: self.array_dims,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for ColumnView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
if self.not_null {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if self.is_array {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if !self.comment.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.comment) as u64;
}
if self.length != 0i32 {
size += 1u64 + ::buffa::types::int32_encoded_len(self.length) as u64;
}
if self.is_named_param {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if self.is_func_call {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if !self.scope.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.scope) as u64;
}
if self.table.is_set() {
let __slot = __cache.reserve();
let inner_size = self.table.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if !self.table_alias.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.table_alias) as u64;
}
if self.r#type.is_set() {
let __slot = __cache.reserve();
let inner_size = self.r#type.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if self.is_sqlc_slice {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if self.embed_table.is_set() {
let __slot = __cache.reserve();
let inner_size = self.embed_table.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if !self.original_name.is_empty() {
size
+= 1u64 + ::buffa::types::string_encoded_len(&self.original_name) as u64;
}
if self.unsigned {
size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if self.array_dims != 0i32 {
size += 2u64 + ::buffa::types::int32_encoded_len(self.array_dims) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
if self.not_null {
::buffa::types::put_bool_field(3u32, self.not_null, buf);
}
if self.is_array {
::buffa::types::put_bool_field(4u32, self.is_array, buf);
}
if !self.comment.is_empty() {
::buffa::types::put_string_field(5u32, &self.comment, buf);
}
if self.length != 0i32 {
::buffa::types::put_int32_field(6u32, self.length, buf);
}
if self.is_named_param {
::buffa::types::put_bool_field(7u32, self.is_named_param, buf);
}
if self.is_func_call {
::buffa::types::put_bool_field(8u32, self.is_func_call, buf);
}
if !self.scope.is_empty() {
::buffa::types::put_string_field(9u32, &self.scope, buf);
}
if self.table.is_set() {
::buffa::types::put_len_delimited_header(
10u32,
u64::from(__cache.consume_next()),
buf,
);
self.table.write_to(__cache, buf);
}
if !self.table_alias.is_empty() {
::buffa::types::put_string_field(11u32, &self.table_alias, buf);
}
if self.r#type.is_set() {
::buffa::types::put_len_delimited_header(
12u32,
u64::from(__cache.consume_next()),
buf,
);
self.r#type.write_to(__cache, buf);
}
if self.is_sqlc_slice {
::buffa::types::put_bool_field(13u32, self.is_sqlc_slice, buf);
}
if self.embed_table.is_set() {
::buffa::types::put_len_delimited_header(
14u32,
u64::from(__cache.consume_next()),
buf,
);
self.embed_table.write_to(__cache, buf);
}
if !self.original_name.is_empty() {
::buffa::types::put_string_field(15u32, &self.original_name, buf);
}
if self.unsigned {
::buffa::types::put_bool_field(16u32, self.unsigned, buf);
}
if self.array_dims != 0i32 {
::buffa::types::put_int32_field(17u32, self.array_dims, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for ColumnView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Column";
const FULL_NAME: &'static str = "plugin.Column";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Column";
}
::buffa::impl_default_view_instance!(ColumnView);
::buffa::impl_view_reborrow!(ColumnView);
#[derive(Clone, Debug)]
pub struct ColumnOwnedView(::buffa::OwnedView<ColumnView<'static>>);
impl ColumnOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(ColumnOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ColumnOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Column,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(ColumnOwnedView(::buffa::OwnedView::from_owned(msg)?))
}
#[must_use]
pub fn view(&self) -> &ColumnView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Column {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
#[must_use]
pub fn not_null(&self) -> bool {
self.0.reborrow().not_null
}
#[must_use]
pub fn is_array(&self) -> bool {
self.0.reborrow().is_array
}
#[must_use]
pub fn comment(&self) -> &'_ str {
self.0.reborrow().comment
}
#[must_use]
pub fn length(&self) -> i32 {
self.0.reborrow().length
}
#[must_use]
pub fn is_named_param(&self) -> bool {
self.0.reborrow().is_named_param
}
#[must_use]
pub fn is_func_call(&self) -> bool {
self.0.reborrow().is_func_call
}
#[must_use]
pub fn scope(&self) -> &'_ str {
self.0.reborrow().scope
}
#[must_use]
pub fn table(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::IdentifierView<'_>> {
&self.0.reborrow().table
}
#[must_use]
pub fn table_alias(&self) -> &'_ str {
self.0.reborrow().table_alias
}
#[must_use]
pub fn r#type(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::IdentifierView<'_>> {
&self.0.reborrow().r#type
}
#[must_use]
pub fn is_sqlc_slice(&self) -> bool {
self.0.reborrow().is_sqlc_slice
}
#[must_use]
pub fn embed_table(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::IdentifierView<'_>> {
&self.0.reborrow().embed_table
}
#[must_use]
pub fn original_name(&self) -> &'_ str {
self.0.reborrow().original_name
}
#[must_use]
pub fn unsigned(&self) -> bool {
self.0.reborrow().unsigned
}
#[must_use]
pub fn array_dims(&self) -> i32 {
self.0.reborrow().array_dims
}
}
impl ::core::convert::From<::buffa::OwnedView<ColumnView<'static>>> for ColumnOwnedView {
fn from(inner: ::buffa::OwnedView<ColumnView<'static>>) -> Self {
ColumnOwnedView(inner)
}
}
impl ::core::convert::From<ColumnOwnedView> for ::buffa::OwnedView<ColumnView<'static>> {
fn from(wrapper: ColumnOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<ColumnView<'static>>>
for ColumnOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<ColumnView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Column {
type View<'a> = ColumnView<'a>;
type ViewHandle = ColumnOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct QueryView<'a> {
pub text: &'a str,
pub name: &'a str,
pub cmd: &'a str,
pub columns: ::buffa::RepeatedView<'a, super::super::__buffa::view::ColumnView<'a>>,
pub params: ::buffa::RepeatedView<
'a,
super::super::__buffa::view::ParameterView<'a>,
>,
pub comments: ::buffa::RepeatedView<'a, &'a str>,
pub filename: &'a str,
pub insert_into_table: ::buffa::MessageFieldView<
super::super::__buffa::view::IdentifierView<'a>,
>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for QueryView<'a> {
type Owned = super::super::Query;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.text = ::buffa::types::borrow_str(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.name = ::buffa::types::borrow_str(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.cmd = ::buffa::types::borrow_str(&mut cur)?;
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.filename = ::buffa::types::borrow_str(&mut cur)?;
}
8u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.insert_into_table.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.insert_into_table = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::IdentifierView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::ColumnView>(),
)?;
view.columns
.push(
<super::super::__buffa::view::ColumnView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::ParameterView>(),
)?;
view.params
.push(
<super::super::__buffa::view::ParameterView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __elem = ::buffa::types::borrow_str(&mut cur)?;
ctx.register_element_memory(
::buffa::__private::element_footprint(&__elem),
)?;
view.comments.push(__elem);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Query, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Query, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Query {
text: self.text.to_string(),
name: self.name.to_string(),
cmd: self.cmd.to_string(),
columns: self
.columns
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
params: self
.params
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
comments: self.comments.iter().map(|s| s.to_string()).collect(),
filename: self.filename.to_string(),
insert_into_table: match self.insert_into_table.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Identifier,
::buffa::Inline<super::super::Identifier>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for QueryView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.text.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64;
}
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
if !self.cmd.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.cmd) as u64;
}
for v in &self.columns {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.params {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.comments {
size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
}
if !self.filename.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.filename) as u64;
}
if self.insert_into_table.is_set() {
let __slot = __cache.reserve();
let inner_size = self.insert_into_table.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.text.is_empty() {
::buffa::types::put_string_field(1u32, &self.text, buf);
}
if !self.name.is_empty() {
::buffa::types::put_string_field(2u32, &self.name, buf);
}
if !self.cmd.is_empty() {
::buffa::types::put_string_field(3u32, &self.cmd, buf);
}
for v in &self.columns {
::buffa::types::put_len_delimited_header(
4u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
for v in &self.params {
::buffa::types::put_len_delimited_header(
5u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
for v in &self.comments {
::buffa::types::put_string_field(6u32, v, buf);
}
if !self.filename.is_empty() {
::buffa::types::put_string_field(7u32, &self.filename, buf);
}
if self.insert_into_table.is_set() {
::buffa::types::put_len_delimited_header(
8u32,
u64::from(__cache.consume_next()),
buf,
);
self.insert_into_table.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for QueryView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Query";
const FULL_NAME: &'static str = "plugin.Query";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Query";
}
::buffa::impl_default_view_instance!(QueryView);
::buffa::impl_view_reborrow!(QueryView);
#[derive(Clone, Debug)]
pub struct QueryOwnedView(::buffa::OwnedView<QueryView<'static>>);
impl QueryOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(QueryOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
QueryOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Query,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(QueryOwnedView(::buffa::OwnedView::from_owned(msg)?))
}
#[must_use]
pub fn view(&self) -> &QueryView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Query {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn text(&self) -> &'_ str {
self.0.reborrow().text
}
#[must_use]
pub fn name(&self) -> &'_ str {
self.0.reborrow().name
}
#[must_use]
pub fn cmd(&self) -> &'_ str {
self.0.reborrow().cmd
}
#[must_use]
pub fn columns(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::ColumnView<'_>> {
&self.0.reborrow().columns
}
#[must_use]
pub fn params(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::ParameterView<'_>> {
&self.0.reborrow().params
}
#[must_use]
pub fn comments(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
&self.0.reborrow().comments
}
#[must_use]
pub fn filename(&self) -> &'_ str {
self.0.reborrow().filename
}
#[must_use]
pub fn insert_into_table(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::IdentifierView<'_>> {
&self.0.reborrow().insert_into_table
}
}
impl ::core::convert::From<::buffa::OwnedView<QueryView<'static>>> for QueryOwnedView {
fn from(inner: ::buffa::OwnedView<QueryView<'static>>) -> Self {
QueryOwnedView(inner)
}
}
impl ::core::convert::From<QueryOwnedView> for ::buffa::OwnedView<QueryView<'static>> {
fn from(wrapper: QueryOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<QueryView<'static>>> for QueryOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<QueryView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Query {
type View<'a> = QueryView<'a>;
type ViewHandle = QueryOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct ParameterView<'a> {
pub number: i32,
pub column: ::buffa::MessageFieldView<super::super::__buffa::view::ColumnView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for ParameterView<'a> {
type Owned = super::super::Parameter;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.number = ::buffa::types::decode_int32(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.column.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.column = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::ColumnView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Parameter, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Parameter, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Parameter {
number: self.number,
column: match self.column.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Column,
::buffa::Inline<super::super::Column>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for ParameterView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if self.number != 0i32 {
size += 1u64 + ::buffa::types::int32_encoded_len(self.number) as u64;
}
if self.column.is_set() {
let __slot = __cache.reserve();
let inner_size = self.column.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.number != 0i32 {
::buffa::types::put_int32_field(1u32, self.number, buf);
}
if self.column.is_set() {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
self.column.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for ParameterView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "Parameter";
const FULL_NAME: &'static str = "plugin.Parameter";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.Parameter";
}
::buffa::impl_default_view_instance!(ParameterView);
::buffa::impl_view_reborrow!(ParameterView);
#[derive(Clone, Debug)]
pub struct ParameterOwnedView(::buffa::OwnedView<ParameterView<'static>>);
impl ParameterOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ParameterOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ParameterOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Parameter,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ParameterOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &ParameterView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Parameter {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn number(&self) -> i32 {
self.0.reborrow().number
}
#[must_use]
pub fn column(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::ColumnView<'_>> {
&self.0.reborrow().column
}
}
impl ::core::convert::From<::buffa::OwnedView<ParameterView<'static>>>
for ParameterOwnedView {
fn from(inner: ::buffa::OwnedView<ParameterView<'static>>) -> Self {
ParameterOwnedView(inner)
}
}
impl ::core::convert::From<ParameterOwnedView>
for ::buffa::OwnedView<ParameterView<'static>> {
fn from(wrapper: ParameterOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<ParameterView<'static>>>
for ParameterOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<ParameterView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Parameter {
type View<'a> = ParameterView<'a>;
type ViewHandle = ParameterOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct GenerateRequestView<'a> {
pub settings: ::buffa::MessageFieldView<
super::super::__buffa::view::SettingsView<'a>,
>,
pub catalog: ::buffa::MessageFieldView<super::super::__buffa::view::CatalogView<'a>>,
pub queries: ::buffa::RepeatedView<'a, super::super::__buffa::view::QueryView<'a>>,
pub sqlc_version: &'a str,
pub plugin_options: &'a [u8],
pub global_options: &'a [u8],
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for GenerateRequestView<'a> {
type Owned = super::super::GenerateRequest;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.settings.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.settings = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::SettingsView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.catalog.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.catalog = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::CatalogView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.sqlc_version = ::buffa::types::borrow_str(&mut cur)?;
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.plugin_options = ::buffa::types::borrow_bytes(&mut cur)?;
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.global_options = ::buffa::types::borrow_bytes(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::QueryView>(),
)?;
view.queries
.push(
<super::super::__buffa::view::QueryView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::GenerateRequest, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::GenerateRequest, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::GenerateRequest {
settings: match self.settings.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Settings,
::buffa::Inline<super::super::Settings>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
catalog: match self.catalog.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::Catalog,
::buffa::Inline<super::super::Catalog>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
queries: self
.queries
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
sqlc_version: self.sqlc_version.to_string(),
plugin_options: (self.plugin_options).to_vec(),
global_options: (self.global_options).to_vec(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for GenerateRequestView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if self.settings.is_set() {
let __slot = __cache.reserve();
let inner_size = self.settings.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if self.catalog.is_set() {
let __slot = __cache.reserve();
let inner_size = self.catalog.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.queries {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if !self.sqlc_version.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.sqlc_version) as u64;
}
if !self.plugin_options.is_empty() {
size
+= 1u64 + ::buffa::types::bytes_encoded_len(&self.plugin_options) as u64;
}
if !self.global_options.is_empty() {
size
+= 1u64 + ::buffa::types::bytes_encoded_len(&self.global_options) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.settings.is_set() {
::buffa::types::put_len_delimited_header(
1u32,
u64::from(__cache.consume_next()),
buf,
);
self.settings.write_to(__cache, buf);
}
if self.catalog.is_set() {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
self.catalog.write_to(__cache, buf);
}
for v in &self.queries {
::buffa::types::put_len_delimited_header(
3u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
if !self.sqlc_version.is_empty() {
::buffa::types::put_string_field(4u32, &self.sqlc_version, buf);
}
if !self.plugin_options.is_empty() {
::buffa::types::put_shared_bytes_field(5u32, &self.plugin_options, buf);
}
if !self.global_options.is_empty() {
::buffa::types::put_shared_bytes_field(6u32, &self.global_options, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for GenerateRequestView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "GenerateRequest";
const FULL_NAME: &'static str = "plugin.GenerateRequest";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.GenerateRequest";
}
::buffa::impl_default_view_instance!(GenerateRequestView);
::buffa::impl_view_reborrow!(GenerateRequestView);
#[derive(Clone, Debug)]
pub struct GenerateRequestOwnedView(::buffa::OwnedView<GenerateRequestView<'static>>);
impl GenerateRequestOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GenerateRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GenerateRequestOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::GenerateRequest,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GenerateRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &GenerateRequestView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::GenerateRequest {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn settings(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::SettingsView<'_>> {
&self.0.reborrow().settings
}
#[must_use]
pub fn catalog(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::CatalogView<'_>> {
&self.0.reborrow().catalog
}
#[must_use]
pub fn queries(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::QueryView<'_>> {
&self.0.reborrow().queries
}
#[must_use]
pub fn sqlc_version(&self) -> &'_ str {
self.0.reborrow().sqlc_version
}
#[must_use]
pub fn plugin_options(&self) -> &'_ [u8] {
self.0.reborrow().plugin_options
}
#[must_use]
pub fn global_options(&self) -> &'_ [u8] {
self.0.reborrow().global_options
}
}
impl ::core::convert::From<::buffa::OwnedView<GenerateRequestView<'static>>>
for GenerateRequestOwnedView {
fn from(inner: ::buffa::OwnedView<GenerateRequestView<'static>>) -> Self {
GenerateRequestOwnedView(inner)
}
}
impl ::core::convert::From<GenerateRequestOwnedView>
for ::buffa::OwnedView<GenerateRequestView<'static>> {
fn from(wrapper: GenerateRequestOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<GenerateRequestView<'static>>>
for GenerateRequestOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<GenerateRequestView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::GenerateRequest {
type View<'a> = GenerateRequestView<'a>;
type ViewHandle = GenerateRequestOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct GenerateResponseView<'a> {
pub files: ::buffa::RepeatedView<'a, super::super::__buffa::view::FileView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for GenerateResponseView<'a> {
type Owned = super::super::GenerateResponse;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::core::mem::size_of::<super::super::__buffa::view::FileView>(),
)?;
view.files
.push(
<super::super::__buffa::view::FileView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::GenerateResponse, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::GenerateResponse, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::GenerateResponse {
files: self
.files
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for GenerateResponseView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
for v in &self.files {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
for v in &self.files {
::buffa::types::put_len_delimited_header(
1u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for GenerateResponseView<'a> {
const PACKAGE: &'static str = "plugin";
const NAME: &'static str = "GenerateResponse";
const FULL_NAME: &'static str = "plugin.GenerateResponse";
const TYPE_URL: &'static str = "type.googleapis.com/plugin.GenerateResponse";
}
::buffa::impl_default_view_instance!(GenerateResponseView);
::buffa::impl_view_reborrow!(GenerateResponseView);
#[derive(Clone, Debug)]
pub struct GenerateResponseOwnedView(::buffa::OwnedView<GenerateResponseView<'static>>);
impl GenerateResponseOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GenerateResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GenerateResponseOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::GenerateResponse,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GenerateResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &GenerateResponseView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::GenerateResponse {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn files(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::FileView<'_>> {
&self.0.reborrow().files
}
}
impl ::core::convert::From<::buffa::OwnedView<GenerateResponseView<'static>>>
for GenerateResponseOwnedView {
fn from(inner: ::buffa::OwnedView<GenerateResponseView<'static>>) -> Self {
GenerateResponseOwnedView(inner)
}
}
impl ::core::convert::From<GenerateResponseOwnedView>
for ::buffa::OwnedView<GenerateResponseView<'static>> {
fn from(wrapper: GenerateResponseOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<GenerateResponseView<'static>>>
for GenerateResponseOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<GenerateResponseView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::GenerateResponse {
type View<'a> = GenerateResponseView<'a>;
type ViewHandle = GenerateResponseOwnedView;
}