#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const MAX_KEY_SIZE: u64 = 256;
pub const MAX_STRING_SIZE: u64 = 12000;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum FlushError {
ReadOnly = 1,
CommitFailed = 2,
}
impl FlushError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::ReadOnly),
2 => Some(Self::CommitFailed),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum ValueType {
IntVal = 1,
FloatVal = 2,
BoolVal = 3,
StringVal = 4,
BytesVal = 5,
}
impl ValueType {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::IntVal),
2 => Some(Self::FloatVal),
3 => Some(Self::BoolVal),
4 => Some(Self::StringVal),
5 => Some(Self::BytesVal),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Debug, PartialEq)]
pub struct GetIteratorGetNextResponse {
pub kvs: Vec<KeyValue>,
}
impl fidl::Standalone for GetIteratorGetNextResponse {}
#[derive(Debug, PartialEq)]
pub struct KeyValue {
pub key: String,
pub val: Value,
}
impl fidl::Standalone for KeyValue {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ListItem {
pub key: String,
pub type_: ValueType,
}
impl fidl::Persistable for ListItem {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ListIteratorGetNextResponse {
pub keys: Vec<ListItem>,
}
impl fidl::Persistable for ListIteratorGetNextResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StoreAccessorDeletePrefixRequest {
pub prefix: String,
}
impl fidl::Persistable for StoreAccessorDeletePrefixRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StoreAccessorDeleteValueRequest {
pub key: String,
}
impl fidl::Persistable for StoreAccessorDeleteValueRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StoreAccessorGetPrefixRequest {
pub prefix: String,
pub it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
}
impl fidl::Standalone for StoreAccessorGetPrefixRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StoreAccessorGetValueRequest {
pub key: String,
}
impl fidl::Persistable for StoreAccessorGetValueRequest {}
#[derive(Debug, PartialEq)]
pub struct StoreAccessorGetValueResponse {
pub val: Option<Box<Value>>,
}
impl fidl::Standalone for StoreAccessorGetValueResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StoreAccessorListPrefixRequest {
pub prefix: String,
pub it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
}
impl fidl::Standalone for StoreAccessorListPrefixRequest {}
#[derive(Debug, PartialEq)]
pub struct StoreAccessorSetValueRequest {
pub key: String,
pub val: Value,
}
impl fidl::Standalone for StoreAccessorSetValueRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StoreCreateAccessorRequest {
pub read_only: bool,
pub accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
}
impl fidl::Standalone for StoreCreateAccessorRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StoreIdentifyRequest {
pub name: String,
}
impl fidl::Persistable for StoreIdentifyRequest {}
#[derive(Debug, PartialEq)]
pub enum Value {
Intval(i64),
Floatval(f64),
Boolval(bool),
Stringval(String),
Bytesval(fidl_fuchsia_mem::Buffer),
}
impl Value {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Intval(_) => 1,
Self::Floatval(_) => 2,
Self::Boolval(_) => 3,
Self::Stringval(_) => 4,
Self::Bytesval(_) => 5,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Standalone for Value {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct GetIteratorMarker;
impl fidl::endpoints::ProtocolMarker for GetIteratorMarker {
type Proxy = GetIteratorProxy;
type RequestStream = GetIteratorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = GetIteratorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) GetIterator";
}
pub trait GetIteratorProxyInterface: Send + Sync {
type GetNextResponseFut: std::future::Future<Output = Result<Vec<KeyValue>, fidl::Error>> + Send;
fn r#get_next(&self) -> Self::GetNextResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct GetIteratorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for GetIteratorSynchronousProxy {
type Proxy = GetIteratorProxy;
type Protocol = GetIteratorMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl GetIteratorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<GetIteratorEvent, fidl::Error> {
GetIteratorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_next(&self, ___deadline: zx::Time) -> Result<Vec<KeyValue>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, GetIteratorGetNextResponse>(
(),
0xe0a5a8ea5dbfbf5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.kvs)
}
}
#[derive(Debug, Clone)]
pub struct GetIteratorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for GetIteratorProxy {
type Protocol = GetIteratorMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl GetIteratorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> GetIteratorEventStream {
GetIteratorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_next(&self) -> fidl::client::QueryResponseFut<Vec<KeyValue>> {
GetIteratorProxyInterface::r#get_next(self)
}
}
impl GetIteratorProxyInterface for GetIteratorProxy {
type GetNextResponseFut = fidl::client::QueryResponseFut<Vec<KeyValue>>;
fn r#get_next(&self) -> Self::GetNextResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<KeyValue>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GetIteratorGetNextResponse,
0xe0a5a8ea5dbfbf5,
>(_buf?)?;
Ok(_response.kvs)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<KeyValue>>(
(),
0xe0a5a8ea5dbfbf5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct GetIteratorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for GetIteratorEventStream {}
impl futures::stream::FusedStream for GetIteratorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for GetIteratorEventStream {
type Item = Result<GetIteratorEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(GetIteratorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum GetIteratorEvent {}
impl GetIteratorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<GetIteratorEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct GetIteratorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for GetIteratorRequestStream {}
impl futures::stream::FusedStream for GetIteratorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for GetIteratorRequestStream {
type Protocol = GetIteratorMarker;
type ControlHandle = GetIteratorControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
GetIteratorControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for GetIteratorRequestStream {
type Item = Result<GetIteratorRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled GetIteratorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0xe0a5a8ea5dbfbf5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = GetIteratorControlHandle { inner: this.inner.clone() };
Ok(GetIteratorRequest::GetNext {
responder: GetIteratorGetNextResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<GetIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum GetIteratorRequest {
GetNext { responder: GetIteratorGetNextResponder },
}
impl GetIteratorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_next(self) -> Option<(GetIteratorGetNextResponder)> {
if let GetIteratorRequest::GetNext { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
GetIteratorRequest::GetNext { .. } => "get_next",
}
}
}
#[derive(Debug, Clone)]
pub struct GetIteratorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for GetIteratorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl GetIteratorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GetIteratorGetNextResponder {
control_handle: std::mem::ManuallyDrop<GetIteratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GetIteratorGetNextResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GetIteratorGetNextResponder {
type ControlHandle = GetIteratorControlHandle;
fn control_handle(&self) -> &GetIteratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GetIteratorGetNextResponder {
pub fn send(self, mut kvs: Vec<KeyValue>) -> Result<(), fidl::Error> {
let _result = self.send_raw(kvs);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut kvs: Vec<KeyValue>) -> Result<(), fidl::Error> {
let _result = self.send_raw(kvs);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut kvs: Vec<KeyValue>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GetIteratorGetNextResponse>(
(kvs.as_mut(),),
self.tx_id,
0xe0a5a8ea5dbfbf5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ListIteratorMarker;
impl fidl::endpoints::ProtocolMarker for ListIteratorMarker {
type Proxy = ListIteratorProxy;
type RequestStream = ListIteratorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ListIteratorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ListIterator";
}
pub trait ListIteratorProxyInterface: Send + Sync {
type GetNextResponseFut: std::future::Future<Output = Result<Vec<ListItem>, fidl::Error>> + Send;
fn r#get_next(&self) -> Self::GetNextResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ListIteratorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ListIteratorSynchronousProxy {
type Proxy = ListIteratorProxy;
type Protocol = ListIteratorMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl ListIteratorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<ListIteratorEvent, fidl::Error> {
ListIteratorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_next(&self, ___deadline: zx::Time) -> Result<Vec<ListItem>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, ListIteratorGetNextResponse>(
(),
0x6d8646b717dd56a2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.keys)
}
}
#[derive(Debug, Clone)]
pub struct ListIteratorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ListIteratorProxy {
type Protocol = ListIteratorMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl ListIteratorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ListIteratorEventStream {
ListIteratorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_next(&self) -> fidl::client::QueryResponseFut<Vec<ListItem>> {
ListIteratorProxyInterface::r#get_next(self)
}
}
impl ListIteratorProxyInterface for ListIteratorProxy {
type GetNextResponseFut = fidl::client::QueryResponseFut<Vec<ListItem>>;
fn r#get_next(&self) -> Self::GetNextResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<ListItem>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ListIteratorGetNextResponse,
0x6d8646b717dd56a2,
>(_buf?)?;
Ok(_response.keys)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ListItem>>(
(),
0x6d8646b717dd56a2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ListIteratorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ListIteratorEventStream {}
impl futures::stream::FusedStream for ListIteratorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ListIteratorEventStream {
type Item = Result<ListIteratorEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(ListIteratorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ListIteratorEvent {}
impl ListIteratorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ListIteratorEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ListIteratorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ListIteratorRequestStream {}
impl futures::stream::FusedStream for ListIteratorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ListIteratorRequestStream {
type Protocol = ListIteratorMarker;
type ControlHandle = ListIteratorControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
ListIteratorControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ListIteratorRequestStream {
type Item = Result<ListIteratorRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled ListIteratorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x6d8646b717dd56a2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ListIteratorControlHandle { inner: this.inner.clone() };
Ok(ListIteratorRequest::GetNext {
responder: ListIteratorGetNextResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ListIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ListIteratorRequest {
GetNext { responder: ListIteratorGetNextResponder },
}
impl ListIteratorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_next(self) -> Option<(ListIteratorGetNextResponder)> {
if let ListIteratorRequest::GetNext { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ListIteratorRequest::GetNext { .. } => "get_next",
}
}
}
#[derive(Debug, Clone)]
pub struct ListIteratorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ListIteratorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl ListIteratorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ListIteratorGetNextResponder {
control_handle: std::mem::ManuallyDrop<ListIteratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ListIteratorGetNextResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ListIteratorGetNextResponder {
type ControlHandle = ListIteratorControlHandle;
fn control_handle(&self) -> &ListIteratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ListIteratorGetNextResponder {
pub fn send(self, mut keys: &[ListItem]) -> Result<(), fidl::Error> {
let _result = self.send_raw(keys);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut keys: &[ListItem]) -> Result<(), fidl::Error> {
let _result = self.send_raw(keys);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut keys: &[ListItem]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ListIteratorGetNextResponse>(
(keys,),
self.tx_id,
0x6d8646b717dd56a2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SecureStoreMarker;
impl fidl::endpoints::ProtocolMarker for SecureStoreMarker {
type Proxy = SecureStoreProxy;
type RequestStream = SecureStoreRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SecureStoreSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.stash.SecureStore";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SecureStoreMarker {}
pub trait SecureStoreProxyInterface: Send + Sync {
fn r#identify(&self, name: &str) -> Result<(), fidl::Error>;
fn r#create_accessor(
&self,
read_only: bool,
accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SecureStoreSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SecureStoreSynchronousProxy {
type Proxy = SecureStoreProxy;
type Protocol = SecureStoreMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl SecureStoreSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<SecureStoreEvent, fidl::Error> {
SecureStoreEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreIdentifyRequest>(
(name,),
0x4327d0764bed131b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreCreateAccessorRequest>(
(read_only, accessor_request),
0x5aaed3604b3bcfbb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct SecureStoreProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for SecureStoreProxy {
type Protocol = SecureStoreMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl SecureStoreProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SecureStoreEventStream {
SecureStoreEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
SecureStoreProxyInterface::r#identify(self, name)
}
pub fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
SecureStoreProxyInterface::r#create_accessor(self, read_only, accessor_request)
}
}
impl SecureStoreProxyInterface for SecureStoreProxy {
fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreIdentifyRequest>(
(name,),
0x4327d0764bed131b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreCreateAccessorRequest>(
(read_only, accessor_request),
0x5aaed3604b3bcfbb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct SecureStoreEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for SecureStoreEventStream {}
impl futures::stream::FusedStream for SecureStoreEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SecureStoreEventStream {
type Item = Result<SecureStoreEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(SecureStoreEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SecureStoreEvent {}
impl SecureStoreEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<SecureStoreEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SecureStoreRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for SecureStoreRequestStream {}
impl futures::stream::FusedStream for SecureStoreRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SecureStoreRequestStream {
type Protocol = SecureStoreMarker;
type ControlHandle = SecureStoreControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
SecureStoreControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for SecureStoreRequestStream {
type Item = Result<SecureStoreRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled SecureStoreRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4327d0764bed131b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreIdentifyRequest);
fidl::encoding::Decoder::decode_into::<StoreIdentifyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SecureStoreControlHandle { inner: this.inner.clone() };
Ok(SecureStoreRequest::Identify { name: req.name, control_handle })
}
0x5aaed3604b3bcfbb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreCreateAccessorRequest);
fidl::encoding::Decoder::decode_into::<StoreCreateAccessorRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SecureStoreControlHandle { inner: this.inner.clone() };
Ok(SecureStoreRequest::CreateAccessor {
read_only: req.read_only,
accessor_request: req.accessor_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SecureStoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum SecureStoreRequest {
Identify { name: String, control_handle: SecureStoreControlHandle },
CreateAccessor {
read_only: bool,
accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
control_handle: SecureStoreControlHandle,
},
}
impl SecureStoreRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_identify(self) -> Option<(String, SecureStoreControlHandle)> {
if let SecureStoreRequest::Identify { name, control_handle } = self {
Some((name, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_accessor(
self,
) -> Option<(bool, fidl::endpoints::ServerEnd<StoreAccessorMarker>, SecureStoreControlHandle)>
{
if let SecureStoreRequest::CreateAccessor { read_only, accessor_request, control_handle } =
self
{
Some((read_only, accessor_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SecureStoreRequest::Identify { .. } => "identify",
SecureStoreRequest::CreateAccessor { .. } => "create_accessor",
}
}
}
#[derive(Debug, Clone)]
pub struct SecureStoreControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for SecureStoreControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl SecureStoreControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StoreMarker;
impl fidl::endpoints::ProtocolMarker for StoreMarker {
type Proxy = StoreProxy;
type RequestStream = StoreRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StoreSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.stash.Store";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StoreMarker {}
pub trait StoreProxyInterface: Send + Sync {
fn r#identify(&self, name: &str) -> Result<(), fidl::Error>;
fn r#create_accessor(
&self,
read_only: bool,
accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StoreSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StoreSynchronousProxy {
type Proxy = StoreProxy;
type Protocol = StoreMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl StoreSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<StoreEvent, fidl::Error> {
StoreEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreIdentifyRequest>(
(name,),
0x4327d0764bed131b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreCreateAccessorRequest>(
(read_only, accessor_request),
0x5aaed3604b3bcfbb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StoreProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for StoreProxy {
type Protocol = StoreMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl StoreProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StoreEventStream {
StoreEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
StoreProxyInterface::r#identify(self, name)
}
pub fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
StoreProxyInterface::r#create_accessor(self, read_only, accessor_request)
}
}
impl StoreProxyInterface for StoreProxy {
fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreIdentifyRequest>(
(name,),
0x4327d0764bed131b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreCreateAccessorRequest>(
(read_only, accessor_request),
0x5aaed3604b3bcfbb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StoreEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for StoreEventStream {}
impl futures::stream::FusedStream for StoreEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StoreEventStream {
type Item = Result<StoreEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(StoreEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StoreEvent {}
impl StoreEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<StoreEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StoreRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for StoreRequestStream {}
impl futures::stream::FusedStream for StoreRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StoreRequestStream {
type Protocol = StoreMarker;
type ControlHandle = StoreControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
StoreControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for StoreRequestStream {
type Item = Result<StoreRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled StoreRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4327d0764bed131b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreIdentifyRequest);
fidl::encoding::Decoder::decode_into::<StoreIdentifyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreControlHandle { inner: this.inner.clone() };
Ok(StoreRequest::Identify { name: req.name, control_handle })
}
0x5aaed3604b3bcfbb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreCreateAccessorRequest);
fidl::encoding::Decoder::decode_into::<StoreCreateAccessorRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreControlHandle { inner: this.inner.clone() };
Ok(StoreRequest::CreateAccessor {
read_only: req.read_only,
accessor_request: req.accessor_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <StoreMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum StoreRequest {
Identify { name: String, control_handle: StoreControlHandle },
CreateAccessor {
read_only: bool,
accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
control_handle: StoreControlHandle,
},
}
impl StoreRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_identify(self) -> Option<(String, StoreControlHandle)> {
if let StoreRequest::Identify { name, control_handle } = self {
Some((name, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_accessor(
self,
) -> Option<(bool, fidl::endpoints::ServerEnd<StoreAccessorMarker>, StoreControlHandle)> {
if let StoreRequest::CreateAccessor { read_only, accessor_request, control_handle } = self {
Some((read_only, accessor_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StoreRequest::Identify { .. } => "identify",
StoreRequest::CreateAccessor { .. } => "create_accessor",
}
}
}
#[derive(Debug, Clone)]
pub struct StoreControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for StoreControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl StoreControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Store2Marker;
impl fidl::endpoints::ProtocolMarker for Store2Marker {
type Proxy = Store2Proxy;
type RequestStream = Store2RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = Store2SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.stash.Store2";
}
impl fidl::endpoints::DiscoverableProtocolMarker for Store2Marker {}
pub trait Store2ProxyInterface: Send + Sync {
fn r#identify(&self, name: &str) -> Result<(), fidl::Error>;
fn r#create_accessor(
&self,
read_only: bool,
accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct Store2SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for Store2SynchronousProxy {
type Proxy = Store2Proxy;
type Protocol = Store2Marker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl Store2SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<Store2Event, fidl::Error> {
Store2Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreIdentifyRequest>(
(name,),
0x4327d0764bed131b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreCreateAccessorRequest>(
(read_only, accessor_request),
0x5aaed3604b3bcfbb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct Store2Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for Store2Proxy {
type Protocol = Store2Marker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl Store2Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> Store2EventStream {
Store2EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
Store2ProxyInterface::r#identify(self, name)
}
pub fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
Store2ProxyInterface::r#create_accessor(self, read_only, accessor_request)
}
}
impl Store2ProxyInterface for Store2Proxy {
fn r#identify(&self, mut name: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreIdentifyRequest>(
(name,),
0x4327d0764bed131b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_accessor(
&self,
mut read_only: bool,
mut accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreCreateAccessorRequest>(
(read_only, accessor_request),
0x5aaed3604b3bcfbb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct Store2EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for Store2EventStream {}
impl futures::stream::FusedStream for Store2EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for Store2EventStream {
type Item = Result<Store2Event, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(Store2Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum Store2Event {}
impl Store2Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<Store2Event, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct Store2RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for Store2RequestStream {}
impl futures::stream::FusedStream for Store2RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for Store2RequestStream {
type Protocol = Store2Marker;
type ControlHandle = Store2ControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
Store2ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for Store2RequestStream {
type Item = Result<Store2Request, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled Store2RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4327d0764bed131b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreIdentifyRequest);
fidl::encoding::Decoder::decode_into::<StoreIdentifyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = Store2ControlHandle { inner: this.inner.clone() };
Ok(Store2Request::Identify { name: req.name, control_handle })
}
0x5aaed3604b3bcfbb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreCreateAccessorRequest);
fidl::encoding::Decoder::decode_into::<StoreCreateAccessorRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = Store2ControlHandle { inner: this.inner.clone() };
Ok(Store2Request::CreateAccessor {
read_only: req.read_only,
accessor_request: req.accessor_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <Store2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum Store2Request {
Identify { name: String, control_handle: Store2ControlHandle },
CreateAccessor {
read_only: bool,
accessor_request: fidl::endpoints::ServerEnd<StoreAccessorMarker>,
control_handle: Store2ControlHandle,
},
}
impl Store2Request {
#[allow(irrefutable_let_patterns)]
pub fn into_identify(self) -> Option<(String, Store2ControlHandle)> {
if let Store2Request::Identify { name, control_handle } = self {
Some((name, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_accessor(
self,
) -> Option<(bool, fidl::endpoints::ServerEnd<StoreAccessorMarker>, Store2ControlHandle)> {
if let Store2Request::CreateAccessor { read_only, accessor_request, control_handle } = self
{
Some((read_only, accessor_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
Store2Request::Identify { .. } => "identify",
Store2Request::CreateAccessor { .. } => "create_accessor",
}
}
}
#[derive(Debug, Clone)]
pub struct Store2ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for Store2ControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl Store2ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StoreAccessorMarker;
impl fidl::endpoints::ProtocolMarker for StoreAccessorMarker {
type Proxy = StoreAccessorProxy;
type RequestStream = StoreAccessorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StoreAccessorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) StoreAccessor";
}
pub type StoreAccessorFlushResult = Result<(), FlushError>;
pub trait StoreAccessorProxyInterface: Send + Sync {
type GetValueResponseFut: std::future::Future<Output = Result<Option<Box<Value>>, fidl::Error>>
+ Send;
fn r#get_value(&self, key: &str) -> Self::GetValueResponseFut;
fn r#set_value(&self, key: &str, val: Value) -> Result<(), fidl::Error>;
fn r#delete_value(&self, key: &str) -> Result<(), fidl::Error>;
fn r#list_prefix(
&self,
prefix: &str,
it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
) -> Result<(), fidl::Error>;
fn r#get_prefix(
&self,
prefix: &str,
it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
) -> Result<(), fidl::Error>;
fn r#delete_prefix(&self, prefix: &str) -> Result<(), fidl::Error>;
fn r#commit(&self) -> Result<(), fidl::Error>;
type FlushResponseFut: std::future::Future<Output = Result<StoreAccessorFlushResult, fidl::Error>>
+ Send;
fn r#flush(&self) -> Self::FlushResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StoreAccessorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StoreAccessorSynchronousProxy {
type Proxy = StoreAccessorProxy;
type Protocol = StoreAccessorMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl StoreAccessorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<StoreAccessorEvent, fidl::Error> {
StoreAccessorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_value(
&self,
mut key: &str,
___deadline: zx::Time,
) -> Result<Option<Box<Value>>, fidl::Error> {
let _response =
self.client.send_query::<StoreAccessorGetValueRequest, StoreAccessorGetValueResponse>(
(key,),
0x757e8893d1347630,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.val)
}
pub fn r#set_value(&self, mut key: &str, mut val: Value) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorSetValueRequest>(
(key, &mut val),
0x58365315c2f38e1c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#delete_value(&self, mut key: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorDeleteValueRequest>(
(key,),
0x64e331813e30ec12,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#list_prefix(
&self,
mut prefix: &str,
mut it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorListPrefixRequest>(
(prefix, it),
0x2e25291acf25331e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_prefix(
&self,
mut prefix: &str,
mut it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorGetPrefixRequest>(
(prefix, it),
0x753ca25534a85c38,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#delete_prefix(&self, mut prefix: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorDeletePrefixRequest>(
(prefix,),
0x468405bac20649c9,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#commit(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6daf402bf765768c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#flush(&self, ___deadline: zx::Time) -> Result<StoreAccessorFlushResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlushError>,
>(
(),
0x463d057712847d12,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct StoreAccessorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for StoreAccessorProxy {
type Protocol = StoreAccessorMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl StoreAccessorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StoreAccessorEventStream {
StoreAccessorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_value(&self, mut key: &str) -> fidl::client::QueryResponseFut<Option<Box<Value>>> {
StoreAccessorProxyInterface::r#get_value(self, key)
}
pub fn r#set_value(&self, mut key: &str, mut val: Value) -> Result<(), fidl::Error> {
StoreAccessorProxyInterface::r#set_value(self, key, val)
}
pub fn r#delete_value(&self, mut key: &str) -> Result<(), fidl::Error> {
StoreAccessorProxyInterface::r#delete_value(self, key)
}
pub fn r#list_prefix(
&self,
mut prefix: &str,
mut it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
) -> Result<(), fidl::Error> {
StoreAccessorProxyInterface::r#list_prefix(self, prefix, it)
}
pub fn r#get_prefix(
&self,
mut prefix: &str,
mut it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
) -> Result<(), fidl::Error> {
StoreAccessorProxyInterface::r#get_prefix(self, prefix, it)
}
pub fn r#delete_prefix(&self, mut prefix: &str) -> Result<(), fidl::Error> {
StoreAccessorProxyInterface::r#delete_prefix(self, prefix)
}
pub fn r#commit(&self) -> Result<(), fidl::Error> {
StoreAccessorProxyInterface::r#commit(self)
}
pub fn r#flush(&self) -> fidl::client::QueryResponseFut<StoreAccessorFlushResult> {
StoreAccessorProxyInterface::r#flush(self)
}
}
impl StoreAccessorProxyInterface for StoreAccessorProxy {
type GetValueResponseFut = fidl::client::QueryResponseFut<Option<Box<Value>>>;
fn r#get_value(&self, mut key: &str) -> Self::GetValueResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Option<Box<Value>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
StoreAccessorGetValueResponse,
0x757e8893d1347630,
>(_buf?)?;
Ok(_response.val)
}
self.client.send_query_and_decode::<StoreAccessorGetValueRequest, Option<Box<Value>>>(
(key,),
0x757e8893d1347630,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#set_value(&self, mut key: &str, mut val: Value) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorSetValueRequest>(
(key, &mut val),
0x58365315c2f38e1c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#delete_value(&self, mut key: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorDeleteValueRequest>(
(key,),
0x64e331813e30ec12,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#list_prefix(
&self,
mut prefix: &str,
mut it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorListPrefixRequest>(
(prefix, it),
0x2e25291acf25331e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#get_prefix(
&self,
mut prefix: &str,
mut it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorGetPrefixRequest>(
(prefix, it),
0x753ca25534a85c38,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#delete_prefix(&self, mut prefix: &str) -> Result<(), fidl::Error> {
self.client.send::<StoreAccessorDeletePrefixRequest>(
(prefix,),
0x468405bac20649c9,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#commit(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6daf402bf765768c,
fidl::encoding::DynamicFlags::empty(),
)
}
type FlushResponseFut = fidl::client::QueryResponseFut<StoreAccessorFlushResult>;
fn r#flush(&self) -> Self::FlushResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<StoreAccessorFlushResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlushError>,
0x463d057712847d12,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StoreAccessorFlushResult>(
(),
0x463d057712847d12,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct StoreAccessorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for StoreAccessorEventStream {}
impl futures::stream::FusedStream for StoreAccessorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StoreAccessorEventStream {
type Item = Result<StoreAccessorEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(StoreAccessorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StoreAccessorEvent {}
impl StoreAccessorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<StoreAccessorEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StoreAccessorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for StoreAccessorRequestStream {}
impl futures::stream::FusedStream for StoreAccessorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StoreAccessorRequestStream {
type Protocol = StoreAccessorMarker;
type ControlHandle = StoreAccessorControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
StoreAccessorControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for StoreAccessorRequestStream {
type Item = Result<StoreAccessorRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled StoreAccessorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x757e8893d1347630 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(StoreAccessorGetValueRequest);
fidl::encoding::Decoder::decode_into::<StoreAccessorGetValueRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::GetValue {
key: req.key,
responder: StoreAccessorGetValueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x58365315c2f38e1c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreAccessorSetValueRequest);
fidl::encoding::Decoder::decode_into::<StoreAccessorSetValueRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::SetValue {
key: req.key,
val: req.val,
control_handle,
})
}
0x64e331813e30ec12 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreAccessorDeleteValueRequest);
fidl::encoding::Decoder::decode_into::<StoreAccessorDeleteValueRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::DeleteValue { key: req.key, control_handle })
}
0x2e25291acf25331e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreAccessorListPrefixRequest);
fidl::encoding::Decoder::decode_into::<StoreAccessorListPrefixRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::ListPrefix {
prefix: req.prefix,
it: req.it,
control_handle,
})
}
0x753ca25534a85c38 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreAccessorGetPrefixRequest);
fidl::encoding::Decoder::decode_into::<StoreAccessorGetPrefixRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::GetPrefix {
prefix: req.prefix,
it: req.it,
control_handle,
})
}
0x468405bac20649c9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StoreAccessorDeletePrefixRequest);
fidl::encoding::Decoder::decode_into::<StoreAccessorDeletePrefixRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::DeletePrefix { prefix: req.prefix, control_handle })
}
0x6daf402bf765768c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::Commit { control_handle })
}
0x463d057712847d12 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StoreAccessorControlHandle { inner: this.inner.clone() };
Ok(StoreAccessorRequest::Flush {
responder: StoreAccessorFlushResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<StoreAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum StoreAccessorRequest {
GetValue { key: String, responder: StoreAccessorGetValueResponder },
SetValue { key: String, val: Value, control_handle: StoreAccessorControlHandle },
DeleteValue { key: String, control_handle: StoreAccessorControlHandle },
ListPrefix {
prefix: String,
it: fidl::endpoints::ServerEnd<ListIteratorMarker>,
control_handle: StoreAccessorControlHandle,
},
GetPrefix {
prefix: String,
it: fidl::endpoints::ServerEnd<GetIteratorMarker>,
control_handle: StoreAccessorControlHandle,
},
DeletePrefix { prefix: String, control_handle: StoreAccessorControlHandle },
Commit { control_handle: StoreAccessorControlHandle },
Flush { responder: StoreAccessorFlushResponder },
}
impl StoreAccessorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_value(self) -> Option<(String, StoreAccessorGetValueResponder)> {
if let StoreAccessorRequest::GetValue { key, responder } = self {
Some((key, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_value(self) -> Option<(String, Value, StoreAccessorControlHandle)> {
if let StoreAccessorRequest::SetValue { key, val, control_handle } = self {
Some((key, val, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_delete_value(self) -> Option<(String, StoreAccessorControlHandle)> {
if let StoreAccessorRequest::DeleteValue { key, control_handle } = self {
Some((key, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_list_prefix(
self,
) -> Option<(String, fidl::endpoints::ServerEnd<ListIteratorMarker>, StoreAccessorControlHandle)>
{
if let StoreAccessorRequest::ListPrefix { prefix, it, control_handle } = self {
Some((prefix, it, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_prefix(
self,
) -> Option<(String, fidl::endpoints::ServerEnd<GetIteratorMarker>, StoreAccessorControlHandle)>
{
if let StoreAccessorRequest::GetPrefix { prefix, it, control_handle } = self {
Some((prefix, it, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_delete_prefix(self) -> Option<(String, StoreAccessorControlHandle)> {
if let StoreAccessorRequest::DeletePrefix { prefix, control_handle } = self {
Some((prefix, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_commit(self) -> Option<(StoreAccessorControlHandle)> {
if let StoreAccessorRequest::Commit { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_flush(self) -> Option<(StoreAccessorFlushResponder)> {
if let StoreAccessorRequest::Flush { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StoreAccessorRequest::GetValue { .. } => "get_value",
StoreAccessorRequest::SetValue { .. } => "set_value",
StoreAccessorRequest::DeleteValue { .. } => "delete_value",
StoreAccessorRequest::ListPrefix { .. } => "list_prefix",
StoreAccessorRequest::GetPrefix { .. } => "get_prefix",
StoreAccessorRequest::DeletePrefix { .. } => "delete_prefix",
StoreAccessorRequest::Commit { .. } => "commit",
StoreAccessorRequest::Flush { .. } => "flush",
}
}
}
#[derive(Debug, Clone)]
pub struct StoreAccessorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for StoreAccessorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl StoreAccessorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StoreAccessorGetValueResponder {
control_handle: std::mem::ManuallyDrop<StoreAccessorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StoreAccessorGetValueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StoreAccessorGetValueResponder {
type ControlHandle = StoreAccessorControlHandle;
fn control_handle(&self) -> &StoreAccessorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StoreAccessorGetValueResponder {
pub fn send(self, mut val: Option<Value>) -> Result<(), fidl::Error> {
let _result = self.send_raw(val);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut val: Option<Value>) -> Result<(), fidl::Error> {
let _result = self.send_raw(val);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut val: Option<Value>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<StoreAccessorGetValueResponse>(
(val.as_mut(),),
self.tx_id,
0x757e8893d1347630,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StoreAccessorFlushResponder {
control_handle: std::mem::ManuallyDrop<StoreAccessorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StoreAccessorFlushResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StoreAccessorFlushResponder {
type ControlHandle = StoreAccessorControlHandle;
fn control_handle(&self) -> &StoreAccessorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StoreAccessorFlushResponder {
pub fn send(self, mut result: Result<(), FlushError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), FlushError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), FlushError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlushError>>(
result,
self.tx_id,
0x463d057712847d12,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for FlushError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for FlushError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for FlushError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FlushError {
#[inline(always)]
fn new_empty() -> Self {
Self::ReadOnly
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ValueType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ValueType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ValueType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ValueType {
#[inline(always)]
fn new_empty() -> Self {
Self::IntVal
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for GetIteratorGetNextResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for GetIteratorGetNextResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<GetIteratorGetNextResponse> for &mut GetIteratorGetNextResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GetIteratorGetNextResponse>(offset);
fidl::encoding::Encode::<GetIteratorGetNextResponse>::encode(
(
<fidl::encoding::UnboundedVector<KeyValue> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.kvs),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<KeyValue>>>
fidl::encoding::Encode<GetIteratorGetNextResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GetIteratorGetNextResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for GetIteratorGetNextResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { kvs: fidl::new_empty!(fidl::encoding::UnboundedVector<KeyValue>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<KeyValue>,
&mut self.kvs,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyValue {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ResourceTypeMarker for KeyValue {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<KeyValue> for &mut KeyValue {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyValue>(offset);
fidl::encoding::Encode::<KeyValue>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<Value as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.val),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>,
T1: fidl::encoding::Encode<Value>,
> fidl::encoding::Encode<KeyValue> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyValue>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for KeyValue {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::BoundedString<256>),
val: fidl::new_empty!(Value),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Value, &mut self.val, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ListItem {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ValueTypeMarker for ListItem {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ListItem> for &ListItem {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ListItem>(offset);
fidl::encoding::Encode::<ListItem>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<ValueType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>,
T1: fidl::encoding::Encode<ValueType>,
> fidl::encoding::Encode<ListItem> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ListItem>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ListItem {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::BoundedString<256>),
type_: fidl::new_empty!(ValueType),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ValueType, &mut self.type_, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ListIteratorGetNextResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ListIteratorGetNextResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ListIteratorGetNextResponse> for &ListIteratorGetNextResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ListIteratorGetNextResponse>(offset);
fidl::encoding::Encode::<ListIteratorGetNextResponse>::encode(
(
<fidl::encoding::UnboundedVector<ListItem> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<ListItem>>>
fidl::encoding::Encode<ListIteratorGetNextResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ListIteratorGetNextResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ListIteratorGetNextResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<ListItem>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<ListItem>,
&mut self.keys,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreAccessorDeletePrefixRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for StoreAccessorDeletePrefixRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreAccessorDeletePrefixRequest>
for &StoreAccessorDeletePrefixRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorDeletePrefixRequest>(offset);
fidl::encoding::Encode::<StoreAccessorDeletePrefixRequest>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.prefix,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>>
fidl::encoding::Encode<StoreAccessorDeletePrefixRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorDeletePrefixRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreAccessorDeletePrefixRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { prefix: fidl::new_empty!(fidl::encoding::BoundedString<256>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.prefix,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreAccessorDeleteValueRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for StoreAccessorDeleteValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreAccessorDeleteValueRequest>
for &StoreAccessorDeleteValueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorDeleteValueRequest>(offset);
fidl::encoding::Encode::<StoreAccessorDeleteValueRequest>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>>
fidl::encoding::Encode<StoreAccessorDeleteValueRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorDeleteValueRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreAccessorDeleteValueRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { key: fidl::new_empty!(fidl::encoding::BoundedString<256>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreAccessorGetPrefixRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for StoreAccessorGetPrefixRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreAccessorGetPrefixRequest>
for &mut StoreAccessorGetPrefixRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorGetPrefixRequest>(offset);
fidl::encoding::Encode::<StoreAccessorGetPrefixRequest>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.it),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>>,
>,
> fidl::encoding::Encode<StoreAccessorGetPrefixRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorGetPrefixRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreAccessorGetPrefixRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
prefix: fidl::new_empty!(fidl::encoding::BoundedString<256>),
it: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.prefix,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GetIteratorMarker>>,
&mut self.it,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreAccessorGetValueRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for StoreAccessorGetValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreAccessorGetValueRequest> for &StoreAccessorGetValueRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorGetValueRequest>(offset);
fidl::encoding::Encode::<StoreAccessorGetValueRequest>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>>
fidl::encoding::Encode<StoreAccessorGetValueRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorGetValueRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreAccessorGetValueRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { key: fidl::new_empty!(fidl::encoding::BoundedString<256>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreAccessorGetValueResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for StoreAccessorGetValueResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreAccessorGetValueResponse>
for &mut StoreAccessorGetValueResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorGetValueResponse>(offset);
fidl::encoding::Encode::<StoreAccessorGetValueResponse>::encode(
(
<fidl::encoding::OptionalUnion<Value> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.val),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::OptionalUnion<Value>>>
fidl::encoding::Encode<StoreAccessorGetValueResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorGetValueResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreAccessorGetValueResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { val: fidl::new_empty!(fidl::encoding::OptionalUnion<Value>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::OptionalUnion<Value>,
&mut self.val,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreAccessorListPrefixRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for StoreAccessorListPrefixRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreAccessorListPrefixRequest>
for &mut StoreAccessorListPrefixRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorListPrefixRequest>(offset);
fidl::encoding::Encode::<StoreAccessorListPrefixRequest>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.it),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>>,
>,
> fidl::encoding::Encode<StoreAccessorListPrefixRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorListPrefixRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreAccessorListPrefixRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
prefix: fidl::new_empty!(fidl::encoding::BoundedString<256>),
it: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.prefix,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListIteratorMarker>>,
&mut self.it,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreAccessorSetValueRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ResourceTypeMarker for StoreAccessorSetValueRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreAccessorSetValueRequest>
for &mut StoreAccessorSetValueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorSetValueRequest>(offset);
fidl::encoding::Encode::<StoreAccessorSetValueRequest>::encode(
(
<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<Value as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.val),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>,
T1: fidl::encoding::Encode<Value>,
> fidl::encoding::Encode<StoreAccessorSetValueRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreAccessorSetValueRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreAccessorSetValueRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::BoundedString<256>),
val: fidl::new_empty!(Value),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Value, &mut self.val, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreCreateAccessorRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for StoreCreateAccessorRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreCreateAccessorRequest> for &mut StoreCreateAccessorRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreCreateAccessorRequest>(offset);
fidl::encoding::Encode::<StoreCreateAccessorRequest>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.read_only),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.accessor_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<bool>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>>,
>,
> fidl::encoding::Encode<StoreCreateAccessorRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreCreateAccessorRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreCreateAccessorRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
read_only: fidl::new_empty!(bool),
accessor_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(bool, &mut self.read_only, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StoreAccessorMarker>>,
&mut self.accessor_request,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StoreIdentifyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for StoreIdentifyRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StoreIdentifyRequest> for &StoreIdentifyRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreIdentifyRequest>(offset);
fidl::encoding::Encode::<StoreIdentifyRequest>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>>>
fidl::encoding::Encode<StoreIdentifyRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StoreIdentifyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StoreIdentifyRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<256>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<256>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Value {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for Value {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Value> for &mut Value {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Value>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Value::Intval(ref val) => {
fidl::encoding::encode_in_envelope::<i64>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::Floatval(ref val) => {
fidl::encoding::encode_in_envelope::<f64>(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::Boolval(ref val) => {
fidl::encoding::encode_in_envelope::<bool>(
<bool as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::Stringval(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<12000>>(
<fidl::encoding::BoundedString<12000> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Value::Bytesval(ref mut val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer>(
<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl fidl::encoding::Decode<Self> for Value {
#[inline(always)]
fn new_empty() -> Self {
Self::Intval(fidl::new_empty!(i64))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <fidl::encoding::BoundedString<12000> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Value::Intval(_) = self {
} else {
*self = Value::Intval(fidl::new_empty!(i64));
}
#[allow(irrefutable_let_patterns)]
if let Value::Intval(ref mut val) = self {
fidl::decode!(i64, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Value::Floatval(_) = self {
} else {
*self = Value::Floatval(fidl::new_empty!(f64));
}
#[allow(irrefutable_let_patterns)]
if let Value::Floatval(ref mut val) = self {
fidl::decode!(f64, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Value::Boolval(_) = self {
} else {
*self = Value::Boolval(fidl::new_empty!(bool));
}
#[allow(irrefutable_let_patterns)]
if let Value::Boolval(ref mut val) = self {
fidl::decode!(bool, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Value::Stringval(_) = self {
} else {
*self = Value::Stringval(fidl::new_empty!(
fidl::encoding::BoundedString<12000>
));
}
#[allow(irrefutable_let_patterns)]
if let Value::Stringval(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<12000>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let Value::Bytesval(_) = self {
} else {
*self = Value::Bytesval(fidl::new_empty!(fidl_fuchsia_mem::Buffer));
}
#[allow(irrefutable_let_patterns)]
if let Value::Bytesval(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_mem::Buffer,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}