#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::endpoints::{ControlHandle as _, Responder as _};
use fuchsia_zircon_status as zx_status;
use futures::future::{self, MaybeDone, TryFutureExt};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub type ControllerId = String;
pub type NamespaceId = String;
pub type Priority = i32;
pub const DEFAULT_ROUTINE_PRIORITY: i32 = 0;
pub const MAX_BATCH_SIZE: u16 = 42;
pub const MAX_COMMIT_SIZE: u16 = 1024;
pub const MAX_NAME_LEN: u8 = 255;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ChangeValidationError {
NotReached,
Ok,
MissingRequiredField,
InvalidInterfaceMatcher,
InvalidAddressMatcher,
InvalidPortMatcher,
InvalidTransparentProxyAction,
InvalidRedirectAction,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! ChangeValidationErrorUnknown {
() => {
_
};
}
impl ChangeValidationError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotReached),
2 => Some(Self::Ok),
3 => Some(Self::MissingRequiredField),
4 => Some(Self::InvalidInterfaceMatcher),
5 => Some(Self::InvalidAddressMatcher),
6 => Some(Self::InvalidPortMatcher),
7 => Some(Self::InvalidTransparentProxyAction),
8 => Some(Self::InvalidRedirectAction),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::NotReached,
2 => Self::Ok,
3 => Self::MissingRequiredField,
4 => Self::InvalidInterfaceMatcher,
5 => Self::InvalidAddressMatcher,
6 => Self::InvalidPortMatcher,
7 => Self::InvalidTransparentProxyAction,
8 => Self::InvalidRedirectAction,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::NotReached => 1,
Self::Ok => 2,
Self::MissingRequiredField => 3,
Self::InvalidInterfaceMatcher => 4,
Self::InvalidAddressMatcher => 5,
Self::InvalidPortMatcher => 6,
Self::InvalidTransparentProxyAction => 7,
Self::InvalidRedirectAction => 8,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum CommitError {
NotReached,
Ok,
NamespaceNotFound,
RoutineNotFound,
RuleNotFound,
AlreadyExists,
TargetRoutineIsInstalled,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! CommitErrorUnknown {
() => {
_
};
}
impl CommitError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotReached),
2 => Some(Self::Ok),
3 => Some(Self::NamespaceNotFound),
4 => Some(Self::RoutineNotFound),
5 => Some(Self::RuleNotFound),
6 => Some(Self::AlreadyExists),
7 => Some(Self::TargetRoutineIsInstalled),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::NotReached,
2 => Self::Ok,
3 => Self::NamespaceNotFound,
4 => Self::RoutineNotFound,
5 => Self::RuleNotFound,
6 => Self::AlreadyExists,
7 => Self::TargetRoutineIsInstalled,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::NotReached => 1,
Self::Ok => 2,
Self::NamespaceNotFound => 3,
Self::RoutineNotFound => 4,
Self::RuleNotFound => 5,
Self::AlreadyExists => 6,
Self::TargetRoutineIsInstalled => 7,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum Domain {
Ipv4,
Ipv6,
AllIp,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! DomainUnknown {
() => {
_
};
}
impl Domain {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Ipv4),
2 => Some(Self::Ipv6),
3 => Some(Self::AllIp),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Ipv4,
2 => Self::Ipv6,
3 => Self::AllIp,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Ipv4 => 1,
Self::Ipv6 => 2,
Self::AllIp => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum IpInstallationHook {
Ingress,
LocalIngress,
Forwarding,
LocalEgress,
Egress,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! IpInstallationHookUnknown {
() => {
_
};
}
impl IpInstallationHook {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Ingress),
2 => Some(Self::LocalIngress),
3 => Some(Self::Forwarding),
4 => Some(Self::LocalEgress),
5 => Some(Self::Egress),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Ingress,
2 => Self::LocalIngress,
3 => Self::Forwarding,
4 => Self::LocalEgress,
5 => Self::Egress,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Ingress => 1,
Self::LocalIngress => 2,
Self::Forwarding => 3,
Self::LocalEgress => 4,
Self::Egress => 5,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum NatInstallationHook {
Ingress,
LocalIngress,
LocalEgress,
Egress,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! NatInstallationHookUnknown {
() => {
_
};
}
impl NatInstallationHook {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Ingress),
2 => Some(Self::LocalIngress),
3 => Some(Self::LocalEgress),
4 => Some(Self::Egress),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Ingress,
2 => Self::LocalIngress,
3 => Self::LocalEgress,
4 => Self::Egress,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Ingress => 1,
Self::LocalIngress => 2,
Self::LocalEgress => 3,
Self::Egress => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct AddedResource {
pub controller: String,
pub resource: Resource,
}
impl fidl::Persistable for AddedResource {}
#[derive(Clone, Debug, PartialEq)]
pub struct AddressMatcher {
pub matcher: AddressMatcherType,
pub invert: bool,
}
impl fidl::Persistable for AddressMatcher {}
#[derive(Clone, Debug, PartialEq)]
pub struct AddressRange {
pub start: fidl_fuchsia_net::IpAddress,
pub end: fidl_fuchsia_net::IpAddress,
}
impl fidl::Persistable for AddressRange {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControlOpenControllerRequest {
pub id: String,
pub request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
}
impl fidl::Standalone for ControlOpenControllerRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControlReopenDetachedControllerRequest {
pub key: ControllerKey,
pub request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
}
impl fidl::Standalone for ControlReopenDetachedControllerRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ControllerKey {
pub uuid: [u8; 16],
}
impl fidl::Persistable for ControllerKey {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Empty;
impl fidl::Persistable for Empty {}
#[derive(Clone, Debug, PartialEq)]
pub struct ExistingResource {
pub controller: String,
pub resource: Resource,
}
impl fidl::Persistable for ExistingResource {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NamespaceControllerOnIdAssignedRequest {
pub id: String,
}
impl fidl::Persistable for NamespaceControllerOnIdAssignedRequest {}
#[derive(Debug, PartialEq)]
pub struct NamespaceControllerPushChangesRequest {
pub changes: Vec<Change>,
}
impl fidl::Standalone for NamespaceControllerPushChangesRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PortMatcher {
pub start: u16,
pub end: u16,
pub invert: bool,
}
impl fidl::Persistable for PortMatcher {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PortRange {
pub start: u16,
pub end: u16,
}
impl fidl::Persistable for PortRange {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemovedResource {
pub controller: String,
pub resource: ResourceId,
}
impl fidl::Persistable for RemovedResource {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RoutineId {
pub namespace: String,
pub name: String,
}
impl fidl::Persistable for RoutineId {}
#[derive(Clone, Debug, PartialEq)]
pub struct Rule {
pub id: RuleId,
pub matchers: Matchers,
pub action: Action,
}
impl fidl::Persistable for Rule {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RuleId {
pub routine: RoutineId,
pub index: u32,
}
impl fidl::Persistable for RuleId {}
#[derive(Clone, Debug, PartialEq)]
pub struct SocketAddr {
pub addr: fidl_fuchsia_net::IpAddress,
pub port: u16,
}
impl fidl::Persistable for SocketAddr {}
#[derive(Debug, PartialEq)]
pub struct StateGetWatcherRequest {
pub options: WatcherOptions,
pub request: fidl::endpoints::ServerEnd<WatcherMarker>,
}
impl fidl::Standalone for StateGetWatcherRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct WatcherWatchResponse {
pub events: Vec<Event>,
}
impl fidl::Persistable for WatcherWatchResponse {}
#[derive(Debug, Default, PartialEq)]
pub struct CommitOptions {
pub idempotent: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for CommitOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IcmpMatcher {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for IcmpMatcher {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Icmpv6Matcher {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Icmpv6Matcher {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct InstalledIpRoutine {
pub hook: Option<IpInstallationHook>,
pub priority: Option<i32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for InstalledIpRoutine {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct InstalledNatRoutine {
pub hook: Option<NatInstallationHook>,
pub priority: Option<i32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for InstalledNatRoutine {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IpRoutine {
pub installation: Option<InstalledIpRoutine>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for IpRoutine {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Matchers {
pub in_interface: Option<InterfaceMatcher>,
pub out_interface: Option<InterfaceMatcher>,
pub src_addr: Option<AddressMatcher>,
pub dst_addr: Option<AddressMatcher>,
pub transport_protocol: Option<TransportProtocol>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Matchers {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Namespace {
pub id: Option<String>,
pub domain: Option<Domain>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Namespace {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NatRoutine {
pub installation: Option<InstalledNatRoutine>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for NatRoutine {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Redirect {
pub dst_port: Option<PortRange>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Redirect {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Routine {
pub id: Option<RoutineId>,
pub type_: Option<RoutineType>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Routine {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TcpMatcher {
pub src_port: Option<PortMatcher>,
pub dst_port: Option<PortMatcher>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for TcpMatcher {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct UdpMatcher {
pub src_port: Option<PortMatcher>,
pub dst_port: Option<PortMatcher>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for UdpMatcher {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct WatcherOptions {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for WatcherOptions {}
#[derive(Clone, Debug)]
pub enum Action {
Accept(Empty),
Drop(Empty),
Jump(String),
Return_(Empty),
TransparentProxy(TransparentProxy_),
Redirect(Redirect),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! ActionUnknown {
() => {
_
};
}
impl PartialEq for Action {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Accept(x), Self::Accept(y)) => *x == *y,
(Self::Drop(x), Self::Drop(y)) => *x == *y,
(Self::Jump(x), Self::Jump(y)) => *x == *y,
(Self::Return_(x), Self::Return_(y)) => *x == *y,
(Self::TransparentProxy(x), Self::TransparentProxy(y)) => *x == *y,
(Self::Redirect(x), Self::Redirect(y)) => *x == *y,
_ => false,
}
}
}
impl Action {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Accept(_) => 1,
Self::Drop(_) => 2,
Self::Jump(_) => 3,
Self::Return_(_) => 4,
Self::TransparentProxy(_) => 5,
Self::Redirect(_) => 6,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for Action {}
#[derive(Clone, Debug)]
pub enum AddressMatcherType {
Subnet(fidl_fuchsia_net::Subnet),
Range(AddressRange),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! AddressMatcherTypeUnknown {
() => {
_
};
}
impl PartialEq for AddressMatcherType {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Subnet(x), Self::Subnet(y)) => *x == *y,
(Self::Range(x), Self::Range(y)) => *x == *y,
_ => false,
}
}
}
impl AddressMatcherType {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Subnet(_) => 1,
Self::Range(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for AddressMatcherType {}
#[derive(Clone, Debug)]
pub enum Change {
Create(Resource),
Remove(ResourceId),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! ChangeUnknown {
() => {
_
};
}
impl PartialEq for Change {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Create(x), Self::Create(y)) => *x == *y,
(Self::Remove(x), Self::Remove(y)) => *x == *y,
_ => false,
}
}
}
impl Change {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Create(_) => 1,
Self::Remove(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for Change {}
#[derive(Debug)]
pub enum ChangeValidationResult {
Ok(Empty),
TooManyChanges(Empty),
ErrorOnChange(Vec<ChangeValidationError>),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! ChangeValidationResultUnknown {
() => {
_
};
}
impl PartialEq for ChangeValidationResult {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Ok(x), Self::Ok(y)) => *x == *y,
(Self::TooManyChanges(x), Self::TooManyChanges(y)) => *x == *y,
(Self::ErrorOnChange(x), Self::ErrorOnChange(y)) => *x == *y,
_ => false,
}
}
}
impl ChangeValidationResult {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Ok(_) => 1,
Self::TooManyChanges(_) => 2,
Self::ErrorOnChange(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Standalone for ChangeValidationResult {}
#[derive(Debug)]
pub enum CommitResult {
Ok(Empty),
RuleWithInvalidMatcher(RuleId),
RuleWithInvalidAction(RuleId),
CyclicalRoutineGraph(RoutineId),
ErrorOnChange(Vec<CommitError>),
TransparentProxyWithInvalidMatcher(RuleId),
RedirectWithInvalidMatcher(RuleId),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! CommitResultUnknown {
() => {
_
};
}
impl PartialEq for CommitResult {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Ok(x), Self::Ok(y)) => *x == *y,
(Self::RuleWithInvalidMatcher(x), Self::RuleWithInvalidMatcher(y)) => *x == *y,
(Self::RuleWithInvalidAction(x), Self::RuleWithInvalidAction(y)) => *x == *y,
(Self::CyclicalRoutineGraph(x), Self::CyclicalRoutineGraph(y)) => *x == *y,
(Self::ErrorOnChange(x), Self::ErrorOnChange(y)) => *x == *y,
(
Self::TransparentProxyWithInvalidMatcher(x),
Self::TransparentProxyWithInvalidMatcher(y),
) => *x == *y,
(Self::RedirectWithInvalidMatcher(x), Self::RedirectWithInvalidMatcher(y)) => *x == *y,
_ => false,
}
}
}
impl CommitResult {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Ok(_) => 1,
Self::RuleWithInvalidMatcher(_) => 2,
Self::RuleWithInvalidAction(_) => 3,
Self::CyclicalRoutineGraph(_) => 4,
Self::ErrorOnChange(_) => 5,
Self::TransparentProxyWithInvalidMatcher(_) => 6,
Self::RedirectWithInvalidMatcher(_) => 7,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Standalone for CommitResult {}
#[derive(Clone, Debug)]
pub enum Event {
Existing(ExistingResource),
Added(AddedResource),
Removed(RemovedResource),
Idle(Empty),
EndOfUpdate(Empty),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! EventUnknown {
() => {
_
};
}
impl PartialEq for Event {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Existing(x), Self::Existing(y)) => *x == *y,
(Self::Added(x), Self::Added(y)) => *x == *y,
(Self::Removed(x), Self::Removed(y)) => *x == *y,
(Self::Idle(x), Self::Idle(y)) => *x == *y,
(Self::EndOfUpdate(x), Self::EndOfUpdate(y)) => *x == *y,
_ => false,
}
}
}
impl Event {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Existing(_) => 1,
Self::Added(_) => 2,
Self::Removed(_) => 3,
Self::Idle(_) => 4,
Self::EndOfUpdate(_) => 5,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for Event {}
#[derive(Clone, Debug)]
pub enum InterfaceMatcher {
Id(u64),
Name(String),
PortClass(fidl_fuchsia_net_interfaces::PortClass),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! InterfaceMatcherUnknown {
() => {
_
};
}
impl PartialEq for InterfaceMatcher {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Id(x), Self::Id(y)) => *x == *y,
(Self::Name(x), Self::Name(y)) => *x == *y,
(Self::PortClass(x), Self::PortClass(y)) => *x == *y,
_ => false,
}
}
}
impl InterfaceMatcher {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Id(_) => 1,
Self::Name(_) => 2,
Self::PortClass(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for InterfaceMatcher {}
#[derive(Clone, Debug)]
pub enum Resource {
Namespace(Namespace),
Routine(Routine),
Rule(Rule),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! ResourceUnknown {
() => {
_
};
}
impl PartialEq for Resource {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Namespace(x), Self::Namespace(y)) => *x == *y,
(Self::Routine(x), Self::Routine(y)) => *x == *y,
(Self::Rule(x), Self::Rule(y)) => *x == *y,
_ => false,
}
}
}
impl Resource {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Namespace(_) => 1,
Self::Routine(_) => 2,
Self::Rule(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for Resource {}
#[derive(Clone, Debug)]
pub enum ResourceId {
Namespace(String),
Routine(RoutineId),
Rule(RuleId),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! ResourceIdUnknown {
() => {
_
};
}
impl PartialEq for ResourceId {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Namespace(x), Self::Namespace(y)) => *x == *y,
(Self::Routine(x), Self::Routine(y)) => *x == *y,
(Self::Rule(x), Self::Rule(y)) => *x == *y,
_ => false,
}
}
}
impl ResourceId {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Namespace(_) => 1,
Self::Routine(_) => 2,
Self::Rule(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for ResourceId {}
#[derive(Clone, Debug)]
pub enum RoutineType {
Ip(IpRoutine),
Nat(NatRoutine),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! RoutineTypeUnknown {
() => {
_
};
}
impl PartialEq for RoutineType {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Ip(x), Self::Ip(y)) => *x == *y,
(Self::Nat(x), Self::Nat(y)) => *x == *y,
_ => false,
}
}
}
impl RoutineType {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Ip(_) => 1,
Self::Nat(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for RoutineType {}
#[derive(Clone, Debug)]
pub enum TransparentProxy_ {
LocalAddr(fidl_fuchsia_net::IpAddress),
LocalPort(u16),
LocalAddrAndPort(SocketAddr),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! TransparentProxy_Unknown {
() => {
_
};
}
impl PartialEq for TransparentProxy_ {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::LocalAddr(x), Self::LocalAddr(y)) => *x == *y,
(Self::LocalPort(x), Self::LocalPort(y)) => *x == *y,
(Self::LocalAddrAndPort(x), Self::LocalAddrAndPort(y)) => *x == *y,
_ => false,
}
}
}
impl TransparentProxy_ {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::LocalAddr(_) => 1,
Self::LocalPort(_) => 2,
Self::LocalAddrAndPort(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for TransparentProxy_ {}
#[derive(Clone, Debug)]
pub enum TransportProtocol {
Tcp(TcpMatcher),
Udp(UdpMatcher),
Icmp(IcmpMatcher),
Icmpv6(Icmpv6Matcher),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! TransportProtocolUnknown {
() => {
_
};
}
impl PartialEq for TransportProtocol {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Tcp(x), Self::Tcp(y)) => *x == *y,
(Self::Udp(x), Self::Udp(y)) => *x == *y,
(Self::Icmp(x), Self::Icmp(y)) => *x == *y,
(Self::Icmpv6(x), Self::Icmpv6(y)) => *x == *y,
_ => false,
}
}
}
impl TransportProtocol {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Tcp(_) => 1,
Self::Udp(_) => 2,
Self::Icmp(_) => 3,
Self::Icmpv6(_) => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for TransportProtocol {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ControlMarker;
impl fidl::endpoints::ProtocolMarker for ControlMarker {
type Proxy = ControlProxy;
type RequestStream = ControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ControlSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.filter.Control";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
pub trait ControlProxyInterface: Send + Sync {
fn r#open_controller(
&self,
id: &str,
request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error>;
fn r#reopen_detached_controller(
&self,
key: &ControllerKey,
request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
type Proxy = ControlProxy;
type Protocol = ControlMarker;
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 ControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ControlMarker 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::MonotonicTime) -> Result<ControlEvent, fidl::Error> {
ControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#open_controller(
&self,
mut id: &str,
mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ControlOpenControllerRequest>(
(id, request),
0x2e1014a4c918d0e6,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#reopen_detached_controller(
&self,
mut key: &ControllerKey,
mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ControlReopenDetachedControllerRequest>(
(key, request),
0x59cf56d70942967a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ControlProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ControlProxy {
type Protocol = ControlMarker;
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 ControlProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ControlEventStream {
ControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#open_controller(
&self,
mut id: &str,
mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error> {
ControlProxyInterface::r#open_controller(self, id, request)
}
pub fn r#reopen_detached_controller(
&self,
mut key: &ControllerKey,
mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error> {
ControlProxyInterface::r#reopen_detached_controller(self, key, request)
}
}
impl ControlProxyInterface for ControlProxy {
fn r#open_controller(
&self,
mut id: &str,
mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ControlOpenControllerRequest>(
(id, request),
0x2e1014a4c918d0e6,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#reopen_detached_controller(
&self,
mut key: &ControllerKey,
mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ControlReopenDetachedControllerRequest>(
(key, request),
0x59cf56d70942967a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ControlEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ControlEventStream {}
impl futures::stream::FusedStream for ControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ControlEventStream {
type Item = Result<ControlEvent, 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(ControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ControlEvent {}
impl ControlEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ControlEvent, 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: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ControlRequestStream {}
impl futures::stream::FusedStream for ControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ControlRequestStream {
type Protocol = ControlMarker;
type ControlHandle = ControlControlHandle;
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 {
ControlControlHandle { 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 ControlRequestStream {
type Item = Result<ControlRequest, 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 ControlRequestStream 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 {
0x2e1014a4c918d0e6 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ControlOpenControllerRequest);
fidl::encoding::Decoder::decode_into::<ControlOpenControllerRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::OpenController {
id: req.id,
request: req.request,
control_handle,
})
}
0x59cf56d70942967a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ControlReopenDetachedControllerRequest);
fidl::encoding::Decoder::decode_into::<ControlReopenDetachedControllerRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ControlControlHandle { inner: this.inner.clone() };
Ok(ControlRequest::ReopenDetachedController {
key: req.key,
request: req.request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ControlRequest {
OpenController {
id: String,
request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
control_handle: ControlControlHandle,
},
ReopenDetachedController {
key: ControllerKey,
request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
control_handle: ControlControlHandle,
},
}
impl ControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_open_controller(
self,
) -> Option<(String, fidl::endpoints::ServerEnd<NamespaceControllerMarker>, ControlControlHandle)>
{
if let ControlRequest::OpenController { id, request, control_handle } = self {
Some((id, request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reopen_detached_controller(
self,
) -> Option<(
ControllerKey,
fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
ControlControlHandle,
)> {
if let ControlRequest::ReopenDetachedController { key, request, control_handle } = self {
Some((key, request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ControlRequest::OpenController { .. } => "open_controller",
ControlRequest::ReopenDetachedController { .. } => "reopen_detached_controller",
}
}
}
#[derive(Debug, Clone)]
pub struct ControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ControlControlHandle {
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 ControlControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct NamespaceControllerMarker;
impl fidl::endpoints::ProtocolMarker for NamespaceControllerMarker {
type Proxy = NamespaceControllerProxy;
type RequestStream = NamespaceControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = NamespaceControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) NamespaceController";
}
pub trait NamespaceControllerProxyInterface: Send + Sync {
type DetachResponseFut: std::future::Future<Output = Result<[u8; 16], fidl::Error>> + Send;
fn r#detach(&self) -> Self::DetachResponseFut;
type PushChangesResponseFut: std::future::Future<Output = Result<ChangeValidationResult, fidl::Error>>
+ Send;
fn r#push_changes(&self, changes: &[Change]) -> Self::PushChangesResponseFut;
type CommitResponseFut: std::future::Future<Output = Result<CommitResult, fidl::Error>> + Send;
fn r#commit(&self, payload: CommitOptions) -> Self::CommitResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct NamespaceControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for NamespaceControllerSynchronousProxy {
type Proxy = NamespaceControllerProxy;
type Protocol = NamespaceControllerMarker;
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 NamespaceControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<NamespaceControllerMarker 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::MonotonicTime,
) -> Result<NamespaceControllerEvent, fidl::Error> {
NamespaceControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#detach(&self, ___deadline: zx::MonotonicTime) -> Result<[u8; 16], fidl::Error> {
let _response = self.client.send_query::<fidl::encoding::EmptyPayload, ControllerKey>(
(),
0x15db86969aaa7c37,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.uuid)
}
pub fn r#push_changes(
&self,
mut changes: &[Change],
___deadline: zx::MonotonicTime,
) -> Result<ChangeValidationResult, fidl::Error> {
let _response = self
.client
.send_query::<NamespaceControllerPushChangesRequest, ChangeValidationResult>(
(changes,),
0x2c814d42c2783ee6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#commit(
&self,
mut payload: CommitOptions,
___deadline: zx::MonotonicTime,
) -> Result<CommitResult, fidl::Error> {
let _response = self.client.send_query::<CommitOptions, CommitResult>(
&mut payload,
0x49ed5545357963e4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct NamespaceControllerProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for NamespaceControllerProxy {
type Protocol = NamespaceControllerMarker;
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 NamespaceControllerProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<NamespaceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> NamespaceControllerEventStream {
NamespaceControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#detach(&self) -> fidl::client::QueryResponseFut<[u8; 16]> {
NamespaceControllerProxyInterface::r#detach(self)
}
pub fn r#push_changes(
&self,
mut changes: &[Change],
) -> fidl::client::QueryResponseFut<ChangeValidationResult> {
NamespaceControllerProxyInterface::r#push_changes(self, changes)
}
pub fn r#commit(
&self,
mut payload: CommitOptions,
) -> fidl::client::QueryResponseFut<CommitResult> {
NamespaceControllerProxyInterface::r#commit(self, payload)
}
}
impl NamespaceControllerProxyInterface for NamespaceControllerProxy {
type DetachResponseFut = fidl::client::QueryResponseFut<[u8; 16]>;
fn r#detach(&self) -> Self::DetachResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<[u8; 16], fidl::Error> {
let _response =
fidl::client::decode_transaction_body::<ControllerKey, 0x15db86969aaa7c37>(_buf?)?;
Ok(_response.uuid)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 16]>(
(),
0x15db86969aaa7c37,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PushChangesResponseFut = fidl::client::QueryResponseFut<ChangeValidationResult>;
fn r#push_changes(&self, mut changes: &[Change]) -> Self::PushChangesResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ChangeValidationResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ChangeValidationResult,
0x2c814d42c2783ee6,
>(_buf?)?;
Ok(_response)
}
self.client
.send_query_and_decode::<NamespaceControllerPushChangesRequest, ChangeValidationResult>(
(changes,),
0x2c814d42c2783ee6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CommitResponseFut = fidl::client::QueryResponseFut<CommitResult>;
fn r#commit(&self, mut payload: CommitOptions) -> Self::CommitResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<CommitResult, fidl::Error> {
let _response =
fidl::client::decode_transaction_body::<CommitResult, 0x49ed5545357963e4>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<CommitOptions, CommitResult>(
&mut payload,
0x49ed5545357963e4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct NamespaceControllerEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for NamespaceControllerEventStream {}
impl futures::stream::FusedStream for NamespaceControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for NamespaceControllerEventStream {
type Item = Result<NamespaceControllerEvent, 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(NamespaceControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum NamespaceControllerEvent {
OnIdAssigned { id: String },
}
impl NamespaceControllerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_id_assigned(self) -> Option<String> {
if let NamespaceControllerEvent::OnIdAssigned { id } = self {
Some((id))
} else {
None
}
}
fn decode(mut buf: fidl::MessageBufEtc) -> Result<NamespaceControllerEvent, 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 {
0x2e218c64a1d5ea74 => {
let mut out = fidl::new_empty!(NamespaceControllerOnIdAssignedRequest);
fidl::encoding::Decoder::decode_into::<NamespaceControllerOnIdAssignedRequest>(
&tx_header,
_body_bytes,
_handles,
&mut out,
)?;
Ok((NamespaceControllerEvent::OnIdAssigned { id: out.id }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<NamespaceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct NamespaceControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for NamespaceControllerRequestStream {}
impl futures::stream::FusedStream for NamespaceControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for NamespaceControllerRequestStream {
type Protocol = NamespaceControllerMarker;
type ControlHandle = NamespaceControllerControlHandle;
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 {
NamespaceControllerControlHandle { 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 NamespaceControllerRequestStream {
type Item = Result<NamespaceControllerRequest, 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 NamespaceControllerRequestStream 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 {
0x15db86969aaa7c37 => {
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 =
NamespaceControllerControlHandle { inner: this.inner.clone() };
Ok(NamespaceControllerRequest::Detach {
responder: NamespaceControllerDetachResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2c814d42c2783ee6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(NamespaceControllerPushChangesRequest);
fidl::encoding::Decoder::decode_into::<NamespaceControllerPushChangesRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
NamespaceControllerControlHandle { inner: this.inner.clone() };
Ok(NamespaceControllerRequest::PushChanges {
changes: req.changes,
responder: NamespaceControllerPushChangesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x49ed5545357963e4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(CommitOptions);
fidl::encoding::Decoder::decode_into::<CommitOptions>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
NamespaceControllerControlHandle { inner: this.inner.clone() };
Ok(NamespaceControllerRequest::Commit {
payload: req,
responder: NamespaceControllerCommitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<NamespaceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum NamespaceControllerRequest {
Detach { responder: NamespaceControllerDetachResponder },
PushChanges { changes: Vec<Change>, responder: NamespaceControllerPushChangesResponder },
Commit { payload: CommitOptions, responder: NamespaceControllerCommitResponder },
}
impl NamespaceControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_detach(self) -> Option<(NamespaceControllerDetachResponder)> {
if let NamespaceControllerRequest::Detach { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_push_changes(
self,
) -> Option<(Vec<Change>, NamespaceControllerPushChangesResponder)> {
if let NamespaceControllerRequest::PushChanges { changes, responder } = self {
Some((changes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_commit(self) -> Option<(CommitOptions, NamespaceControllerCommitResponder)> {
if let NamespaceControllerRequest::Commit { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
NamespaceControllerRequest::Detach { .. } => "detach",
NamespaceControllerRequest::PushChanges { .. } => "push_changes",
NamespaceControllerRequest::Commit { .. } => "commit",
}
}
}
#[derive(Debug, Clone)]
pub struct NamespaceControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for NamespaceControllerControlHandle {
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 NamespaceControllerControlHandle {
pub fn send_on_id_assigned(&self, mut id: &str) -> Result<(), fidl::Error> {
self.inner.send::<NamespaceControllerOnIdAssignedRequest>(
(id,),
0,
0x2e218c64a1d5ea74,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NamespaceControllerDetachResponder {
control_handle: std::mem::ManuallyDrop<NamespaceControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NamespaceControllerDetachResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NamespaceControllerDetachResponder {
type ControlHandle = NamespaceControllerControlHandle;
fn control_handle(&self) -> &NamespaceControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NamespaceControllerDetachResponder {
pub fn send(self, mut uuid: &[u8; 16]) -> Result<(), fidl::Error> {
let _result = self.send_raw(uuid);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut uuid: &[u8; 16]) -> Result<(), fidl::Error> {
let _result = self.send_raw(uuid);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut uuid: &[u8; 16]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ControllerKey>(
(uuid,),
self.tx_id,
0x15db86969aaa7c37,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NamespaceControllerPushChangesResponder {
control_handle: std::mem::ManuallyDrop<NamespaceControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NamespaceControllerPushChangesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NamespaceControllerPushChangesResponder {
type ControlHandle = NamespaceControllerControlHandle;
fn control_handle(&self) -> &NamespaceControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NamespaceControllerPushChangesResponder {
pub fn send(self, mut payload: ChangeValidationResult) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut payload: ChangeValidationResult,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: ChangeValidationResult) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ChangeValidationResult>(
&mut payload,
self.tx_id,
0x2c814d42c2783ee6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NamespaceControllerCommitResponder {
control_handle: std::mem::ManuallyDrop<NamespaceControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NamespaceControllerCommitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NamespaceControllerCommitResponder {
type ControlHandle = NamespaceControllerControlHandle;
fn control_handle(&self) -> &NamespaceControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NamespaceControllerCommitResponder {
pub fn send(self, mut payload: CommitResult) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut payload: CommitResult) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: CommitResult) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CommitResult>(
&mut payload,
self.tx_id,
0x49ed5545357963e4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StateMarker;
impl fidl::endpoints::ProtocolMarker for StateMarker {
type Proxy = StateProxy;
type RequestStream = StateRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StateSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.filter.State";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
pub trait StateProxyInterface: Send + Sync {
fn r#get_watcher(
&self,
options: &WatcherOptions,
request: fidl::endpoints::ServerEnd<WatcherMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StateSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
type Proxy = StateProxy;
type Protocol = StateMarker;
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 StateSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StateMarker 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::MonotonicTime) -> Result<StateEvent, fidl::Error> {
StateEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_watcher(
&self,
mut options: &WatcherOptions,
mut request: fidl::endpoints::ServerEnd<WatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StateGetWatcherRequest>(
(options, request),
0x663aae2b6bc5aa14,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StateProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for StateProxy {
type Protocol = StateMarker;
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 StateProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StateEventStream {
StateEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_watcher(
&self,
mut options: &WatcherOptions,
mut request: fidl::endpoints::ServerEnd<WatcherMarker>,
) -> Result<(), fidl::Error> {
StateProxyInterface::r#get_watcher(self, options, request)
}
}
impl StateProxyInterface for StateProxy {
fn r#get_watcher(
&self,
mut options: &WatcherOptions,
mut request: fidl::endpoints::ServerEnd<WatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StateGetWatcherRequest>(
(options, request),
0x663aae2b6bc5aa14,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StateEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for StateEventStream {}
impl futures::stream::FusedStream for StateEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StateEventStream {
type Item = Result<StateEvent, 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(StateEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StateEvent {}
impl StateEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<StateEvent, 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: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StateRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for StateRequestStream {}
impl futures::stream::FusedStream for StateRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StateRequestStream {
type Protocol = StateMarker;
type ControlHandle = StateControlHandle;
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 {
StateControlHandle { 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 StateRequestStream {
type Item = Result<StateRequest, 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 StateRequestStream 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 {
0x663aae2b6bc5aa14 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(StateGetWatcherRequest);
fidl::encoding::Decoder::decode_into::<StateGetWatcherRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StateControlHandle { inner: this.inner.clone() };
Ok(StateRequest::GetWatcher {
options: req.options,
request: req.request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum StateRequest {
GetWatcher {
options: WatcherOptions,
request: fidl::endpoints::ServerEnd<WatcherMarker>,
control_handle: StateControlHandle,
},
}
impl StateRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_watcher(
self,
) -> Option<(WatcherOptions, fidl::endpoints::ServerEnd<WatcherMarker>, StateControlHandle)>
{
if let StateRequest::GetWatcher { options, request, control_handle } = self {
Some((options, request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StateRequest::GetWatcher { .. } => "get_watcher",
}
}
}
#[derive(Debug, Clone)]
pub struct StateControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for StateControlHandle {
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 StateControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct WatcherMarker;
impl fidl::endpoints::ProtocolMarker for WatcherMarker {
type Proxy = WatcherProxy;
type RequestStream = WatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = WatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Watcher";
}
pub trait WatcherProxyInterface: Send + Sync {
type WatchResponseFut: std::future::Future<Output = Result<Vec<Event>, fidl::Error>> + Send;
fn r#watch(&self) -> Self::WatchResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct WatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for WatcherSynchronousProxy {
type Proxy = WatcherProxy;
type Protocol = WatcherMarker;
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 WatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <WatcherMarker 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::MonotonicTime) -> Result<WatcherEvent, fidl::Error> {
WatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch(&self, ___deadline: zx::MonotonicTime) -> Result<Vec<Event>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, WatcherWatchResponse>(
(),
0x5f62165a0638ca75,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.events)
}
}
#[derive(Debug, Clone)]
pub struct WatcherProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for WatcherProxy {
type Protocol = WatcherMarker;
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 WatcherProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> WatcherEventStream {
WatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch(&self) -> fidl::client::QueryResponseFut<Vec<Event>> {
WatcherProxyInterface::r#watch(self)
}
}
impl WatcherProxyInterface for WatcherProxy {
type WatchResponseFut = fidl::client::QueryResponseFut<Vec<Event>>;
fn r#watch(&self) -> Self::WatchResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<Event>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
WatcherWatchResponse,
0x5f62165a0638ca75,
>(_buf?)?;
Ok(_response.events)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Event>>(
(),
0x5f62165a0638ca75,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct WatcherEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for WatcherEventStream {}
impl futures::stream::FusedStream for WatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for WatcherEventStream {
type Item = Result<WatcherEvent, 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(WatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum WatcherEvent {}
impl WatcherEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<WatcherEvent, 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: <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct WatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for WatcherRequestStream {}
impl futures::stream::FusedStream for WatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for WatcherRequestStream {
type Protocol = WatcherMarker;
type ControlHandle = WatcherControlHandle;
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 {
WatcherControlHandle { 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 WatcherRequestStream {
type Item = Result<WatcherRequest, 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 WatcherRequestStream 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 {
0x5f62165a0638ca75 => {
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 = WatcherControlHandle { inner: this.inner.clone() };
Ok(WatcherRequest::Watch {
responder: WatcherWatchResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum WatcherRequest {
Watch { responder: WatcherWatchResponder },
}
impl WatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch(self) -> Option<(WatcherWatchResponder)> {
if let WatcherRequest::Watch { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
WatcherRequest::Watch { .. } => "watch",
}
}
}
#[derive(Debug, Clone)]
pub struct WatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for WatcherControlHandle {
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 WatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WatcherWatchResponder {
control_handle: std::mem::ManuallyDrop<WatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for WatcherWatchResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WatcherWatchResponder {
type ControlHandle = WatcherControlHandle;
fn control_handle(&self) -> &WatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl WatcherWatchResponder {
pub fn send(self, mut events: &[Event]) -> Result<(), fidl::Error> {
let _result = self.send_raw(events);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut events: &[Event]) -> Result<(), fidl::Error> {
let _result = self.send_raw(events);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut events: &[Event]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<WatcherWatchResponse>(
(events,),
self.tx_id,
0x5f62165a0638ca75,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for ChangeValidationError {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ChangeValidationError {
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 ChangeValidationError {
#[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 ChangeValidationError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for CommitError {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for CommitError {
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 CommitError {
#[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 CommitError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Domain {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Domain {
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 Domain {
#[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 Domain {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for IpInstallationHook {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for IpInstallationHook {
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 IpInstallationHook {
#[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 IpInstallationHook {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for NatInstallationHook {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for NatInstallationHook {
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 NatInstallationHook {
#[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 NatInstallationHook {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AddedResource {
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::ValueTypeMarker for AddedResource {
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<AddedResource> for &AddedResource {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AddedResource>(offset);
fidl::encoding::Encode::<AddedResource>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.controller,
),
<Resource as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<Resource>,
> fidl::encoding::Encode<AddedResource> 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::<AddedResource>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AddedResource {
#[inline(always)]
fn new_empty() -> Self {
Self {
controller: fidl::new_empty!(fidl::encoding::BoundedString<255>),
resource: fidl::new_empty!(Resource),
}
}
#[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<255>,
&mut self.controller,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Resource, &mut self.resource, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AddressMatcher {
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 AddressMatcher {
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<AddressMatcher> for &AddressMatcher {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AddressMatcher>(offset);
fidl::encoding::Encode::<AddressMatcher>::encode(
(
<AddressMatcherType as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<AddressMatcherType>, T1: fidl::encoding::Encode<bool>>
fidl::encoding::Encode<AddressMatcher> 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::<AddressMatcher>(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 AddressMatcher {
#[inline(always)]
fn new_empty() -> Self {
Self { matcher: fidl::new_empty!(AddressMatcherType), invert: fidl::new_empty!(bool) }
}
#[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!(AddressMatcherType, &mut self.matcher, decoder, offset + 0, _depth)?;
fidl::decode!(bool, &mut self.invert, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AddressRange {
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::ValueTypeMarker for AddressRange {
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<AddressRange> for &AddressRange {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AddressRange>(offset);
fidl::encoding::Encode::<AddressRange>::encode(
(
<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
&self.start,
),
<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
&self.end,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress>,
T1: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress>,
> fidl::encoding::Encode<AddressRange> 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::<AddressRange>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AddressRange {
#[inline(always)]
fn new_empty() -> Self {
Self {
start: fidl::new_empty!(fidl_fuchsia_net::IpAddress),
end: fidl::new_empty!(fidl_fuchsia_net::IpAddress),
}
}
#[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_fuchsia_net::IpAddress,
&mut self.start,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_net::IpAddress,
&mut self.end,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ControlOpenControllerRequest {
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 ControlOpenControllerRequest {
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<ControlOpenControllerRequest>
for &mut ControlOpenControllerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlOpenControllerRequest>(offset);
fidl::encoding::Encode::<ControlOpenControllerRequest>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
>,
> fidl::encoding::Encode<ControlOpenControllerRequest> 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::<ControlOpenControllerRequest>(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 ControlOpenControllerRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl::encoding::BoundedString<255>),
request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>
),
}
}
#[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<255>,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
&mut self.request,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ControlReopenDetachedControllerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
20
}
}
impl fidl::encoding::ResourceTypeMarker for ControlReopenDetachedControllerRequest {
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<ControlReopenDetachedControllerRequest>
for &mut ControlReopenDetachedControllerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControlReopenDetachedControllerRequest>(offset);
fidl::encoding::Encode::<ControlReopenDetachedControllerRequest>::encode(
(
<ControllerKey as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ControllerKey>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
>,
> fidl::encoding::Encode<ControlReopenDetachedControllerRequest> 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::<ControlReopenDetachedControllerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ControlReopenDetachedControllerRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(ControllerKey),
request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>
),
}
}
#[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!(ControllerKey, &mut self.key, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
&mut self.request,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ControllerKey {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for ControllerKey {
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<ControllerKey> for &ControllerKey {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerKey>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ControllerKey)
.write_unaligned((self as *const ControllerKey).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>>>
fidl::encoding::Encode<ControllerKey> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerKey>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ControllerKey {
#[inline(always)]
fn new_empty() -> Self {
Self { uuid: fidl::new_empty!(fidl::encoding::Array<u8, 16>) }
}
#[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 buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Empty {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for Empty {
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<Empty> for &Empty {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Empty>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Empty {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[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);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
unsafe impl fidl::encoding::TypeMarker for ExistingResource {
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::ValueTypeMarker for ExistingResource {
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<ExistingResource> for &ExistingResource {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExistingResource>(offset);
fidl::encoding::Encode::<ExistingResource>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.controller,
),
<Resource as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<Resource>,
> fidl::encoding::Encode<ExistingResource> 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::<ExistingResource>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ExistingResource {
#[inline(always)]
fn new_empty() -> Self {
Self {
controller: fidl::new_empty!(fidl::encoding::BoundedString<255>),
resource: fidl::new_empty!(Resource),
}
}
#[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<255>,
&mut self.controller,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Resource, &mut self.resource, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for NamespaceControllerOnIdAssignedRequest {
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 NamespaceControllerOnIdAssignedRequest {
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<NamespaceControllerOnIdAssignedRequest>
for &NamespaceControllerOnIdAssignedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NamespaceControllerOnIdAssignedRequest>(offset);
fidl::encoding::Encode::<NamespaceControllerOnIdAssignedRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<NamespaceControllerOnIdAssignedRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NamespaceControllerOnIdAssignedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for NamespaceControllerOnIdAssignedRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[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<255>,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for NamespaceControllerPushChangesRequest {
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 NamespaceControllerPushChangesRequest {
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<NamespaceControllerPushChangesRequest>
for &mut NamespaceControllerPushChangesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NamespaceControllerPushChangesRequest>(offset);
fidl::encoding::Encode::<NamespaceControllerPushChangesRequest>::encode(
(<fidl::encoding::Vector<Change, 42> as fidl::encoding::ValueTypeMarker>::borrow(
&self.changes,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<Change, 42>>>
fidl::encoding::Encode<NamespaceControllerPushChangesRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NamespaceControllerPushChangesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for NamespaceControllerPushChangesRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { changes: fidl::new_empty!(fidl::encoding::Vector<Change, 42>) }
}
#[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::Vector<Change, 42>, &mut self.changes, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PortMatcher {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
6
}
}
impl fidl::encoding::ValueTypeMarker for PortMatcher {
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<PortMatcher> for &PortMatcher {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PortMatcher>(offset);
fidl::encoding::Encode::<PortMatcher>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.start),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.end),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u16>,
T1: fidl::encoding::Encode<u16>,
T2: fidl::encoding::Encode<bool>,
> fidl::encoding::Encode<PortMatcher> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PortMatcher>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
(ptr as *mut u16).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
self.2.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PortMatcher {
#[inline(always)]
fn new_empty() -> Self {
Self {
start: fidl::new_empty!(u16),
end: fidl::new_empty!(u16),
invert: fidl::new_empty!(bool),
}
}
#[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(4) };
let padval = unsafe { (ptr as *const u16).read_unaligned() };
let mask = 0xff00u16;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u16, &mut self.start, decoder, offset + 0, _depth)?;
fidl::decode!(u16, &mut self.end, decoder, offset + 2, _depth)?;
fidl::decode!(bool, &mut self.invert, decoder, offset + 4, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PortRange {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for PortRange {
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<PortRange> for &PortRange {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PortRange>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PortRange).write_unaligned((self as *const PortRange).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u16>, T1: fidl::encoding::Encode<u16>>
fidl::encoding::Encode<PortRange> 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::<PortRange>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PortRange {
#[inline(always)]
fn new_empty() -> Self {
Self { start: fidl::new_empty!(u16), end: fidl::new_empty!(u16) }
}
#[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 buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RemovedResource {
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::ValueTypeMarker for RemovedResource {
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<RemovedResource> for &RemovedResource {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemovedResource>(offset);
fidl::encoding::Encode::<RemovedResource>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.controller,
),
<ResourceId as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<ResourceId>,
> fidl::encoding::Encode<RemovedResource> 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::<RemovedResource>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RemovedResource {
#[inline(always)]
fn new_empty() -> Self {
Self {
controller: fidl::new_empty!(fidl::encoding::BoundedString<255>),
resource: fidl::new_empty!(ResourceId),
}
}
#[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<255>,
&mut self.controller,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ResourceId, &mut self.resource, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RoutineId {
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::ValueTypeMarker for RoutineId {
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<RoutineId> for &RoutineId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RoutineId>(offset);
fidl::encoding::Encode::<RoutineId>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.namespace,
),
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
> fidl::encoding::Encode<RoutineId> 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::<RoutineId>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RoutineId {
#[inline(always)]
fn new_empty() -> Self {
Self {
namespace: fidl::new_empty!(fidl::encoding::BoundedString<255>),
name: fidl::new_empty!(fidl::encoding::BoundedString<255>),
}
}
#[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<255>,
&mut self.namespace,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.name,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Rule {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
72
}
}
impl fidl::encoding::ValueTypeMarker for Rule {
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<Rule> for &Rule {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Rule>(offset);
fidl::encoding::Encode::<Rule>::encode(
(
<RuleId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<Matchers as fidl::encoding::ValueTypeMarker>::borrow(&self.matchers),
<Action as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<RuleId>,
T1: fidl::encoding::Encode<Matchers>,
T2: fidl::encoding::Encode<Action>,
> fidl::encoding::Encode<Rule> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Rule>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 40, depth)?;
self.2.encode(encoder, offset + 56, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Rule {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(RuleId),
matchers: fidl::new_empty!(Matchers),
action: fidl::new_empty!(Action),
}
}
#[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!(RuleId, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(Matchers, &mut self.matchers, decoder, offset + 40, _depth)?;
fidl::decode!(Action, &mut self.action, decoder, offset + 56, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RuleId {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ValueTypeMarker for RuleId {
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<RuleId> for &RuleId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleId>(offset);
fidl::encoding::Encode::<RuleId>::encode(
(
<RoutineId as fidl::encoding::ValueTypeMarker>::borrow(&self.routine),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<RoutineId>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<RuleId> 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::<RuleId>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RuleId {
#[inline(always)]
fn new_empty() -> Self {
Self { routine: fidl::new_empty!(RoutineId), index: fidl::new_empty!(u32) }
}
#[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(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(RoutineId, &mut self.routine, decoder, offset + 0, _depth)?;
fidl::decode!(u32, &mut self.index, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SocketAddr {
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 SocketAddr {
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<SocketAddr> for &SocketAddr {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketAddr>(offset);
fidl::encoding::Encode::<SocketAddr>::encode(
(
<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
&self.addr,
),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress>,
T1: fidl::encoding::Encode<u16>,
> fidl::encoding::Encode<SocketAddr> 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::<SocketAddr>(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 SocketAddr {
#[inline(always)]
fn new_empty() -> Self {
Self {
addr: fidl::new_empty!(fidl_fuchsia_net::IpAddress),
port: fidl::new_empty!(u16),
}
}
#[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 = 0xffffffffffff0000u64;
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_fuchsia_net::IpAddress,
&mut self.addr,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u16, &mut self.port, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StateGetWatcherRequest {
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 StateGetWatcherRequest {
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<StateGetWatcherRequest> for &mut StateGetWatcherRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StateGetWatcherRequest>(offset);
fidl::encoding::Encode::<StateGetWatcherRequest>::encode(
(
<WatcherOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<WatcherOptions>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>>,
>,
> fidl::encoding::Encode<StateGetWatcherRequest> 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::<StateGetWatcherRequest>(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 StateGetWatcherRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
options: fidl::new_empty!(WatcherOptions),
request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>>
),
}
}
#[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!(WatcherOptions, &mut self.options, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>>,
&mut self.request,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for WatcherWatchResponse {
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 WatcherWatchResponse {
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<WatcherWatchResponse> for &WatcherWatchResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
fidl::encoding::Encode::<WatcherWatchResponse>::encode(
(<fidl::encoding::Vector<Event, 42> as fidl::encoding::ValueTypeMarker>::borrow(
&self.events,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<Event, 42>>>
fidl::encoding::Encode<WatcherWatchResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for WatcherWatchResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { events: fidl::new_empty!(fidl::encoding::Vector<Event, 42>) }
}
#[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::Vector<Event, 42>, &mut self.events, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl CommitOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.idempotent {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for CommitOptions {
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 CommitOptions {
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<CommitOptions> for &mut CommitOptions {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommitOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.idempotent.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CommitOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.idempotent.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl IcmpMatcher {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
unsafe impl fidl::encoding::TypeMarker for IcmpMatcher {
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 IcmpMatcher {
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<IcmpMatcher> for &IcmpMatcher {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IcmpMatcher>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IcmpMatcher {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl Icmpv6Matcher {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
unsafe impl fidl::encoding::TypeMarker for Icmpv6Matcher {
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 Icmpv6Matcher {
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<Icmpv6Matcher> for &Icmpv6Matcher {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Icmpv6Matcher>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Icmpv6Matcher {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl InstalledIpRoutine {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.priority {
return 2;
}
if let Some(_) = self.hook {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for InstalledIpRoutine {
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 InstalledIpRoutine {
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<InstalledIpRoutine> for &InstalledIpRoutine {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InstalledIpRoutine>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<IpInstallationHook>(
self.hook
.as_ref()
.map(<IpInstallationHook as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i32>(
self.priority.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InstalledIpRoutine {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<IpInstallationHook as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.hook.get_or_insert_with(|| fidl::new_empty!(IpInstallationHook));
fidl::decode!(IpInstallationHook, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(i32));
fidl::decode!(i32, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl InstalledNatRoutine {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.priority {
return 2;
}
if let Some(_) = self.hook {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for InstalledNatRoutine {
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 InstalledNatRoutine {
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<InstalledNatRoutine> for &InstalledNatRoutine {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InstalledNatRoutine>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<NatInstallationHook>(
self.hook
.as_ref()
.map(<NatInstallationHook as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i32>(
self.priority.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InstalledNatRoutine {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<NatInstallationHook as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.hook.get_or_insert_with(|| fidl::new_empty!(NatInstallationHook));
fidl::decode!(NatInstallationHook, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(i32));
fidl::decode!(i32, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl IpRoutine {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.installation {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for IpRoutine {
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 IpRoutine {
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<IpRoutine> for &IpRoutine {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IpRoutine>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<InstalledIpRoutine>(
self.installation
.as_ref()
.map(<InstalledIpRoutine as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IpRoutine {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<InstalledIpRoutine as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.installation.get_or_insert_with(|| fidl::new_empty!(InstalledIpRoutine));
fidl::decode!(InstalledIpRoutine, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl Matchers {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.transport_protocol {
return 5;
}
if let Some(_) = self.dst_addr {
return 4;
}
if let Some(_) = self.src_addr {
return 3;
}
if let Some(_) = self.out_interface {
return 2;
}
if let Some(_) = self.in_interface {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Matchers {
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 Matchers {
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<Matchers> for &Matchers {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Matchers>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<InterfaceMatcher>(
self.in_interface
.as_ref()
.map(<InterfaceMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<InterfaceMatcher>(
self.out_interface
.as_ref()
.map(<InterfaceMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AddressMatcher>(
self.src_addr
.as_ref()
.map(<AddressMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AddressMatcher>(
self.dst_addr
.as_ref()
.map(<AddressMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<TransportProtocol>(
self.transport_protocol
.as_ref()
.map(<TransportProtocol as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Matchers {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<InterfaceMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.in_interface.get_or_insert_with(|| fidl::new_empty!(InterfaceMatcher));
fidl::decode!(InterfaceMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<InterfaceMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.out_interface.get_or_insert_with(|| fidl::new_empty!(InterfaceMatcher));
fidl::decode!(InterfaceMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<AddressMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.src_addr.get_or_insert_with(|| fidl::new_empty!(AddressMatcher));
fidl::decode!(AddressMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<AddressMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.dst_addr.get_or_insert_with(|| fidl::new_empty!(AddressMatcher));
fidl::decode!(AddressMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<TransportProtocol as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.transport_protocol
.get_or_insert_with(|| fidl::new_empty!(TransportProtocol));
fidl::decode!(TransportProtocol, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl Namespace {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.domain {
return 2;
}
if let Some(_) = self.id {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Namespace {
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 Namespace {
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<Namespace> for &Namespace {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Namespace>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.id.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Domain>(
self.domain.as_ref().map(<Domain as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Namespace {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.id
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Domain as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.domain.get_or_insert_with(|| fidl::new_empty!(Domain));
fidl::decode!(Domain, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl NatRoutine {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.installation {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for NatRoutine {
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 NatRoutine {
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<NatRoutine> for &NatRoutine {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NatRoutine>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<InstalledNatRoutine>(
self.installation
.as_ref()
.map(<InstalledNatRoutine as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for NatRoutine {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<InstalledNatRoutine as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.installation.get_or_insert_with(|| fidl::new_empty!(InstalledNatRoutine));
fidl::decode!(InstalledNatRoutine, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl Redirect {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.dst_port {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Redirect {
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 Redirect {
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<Redirect> for &Redirect {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Redirect>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PortRange>(
self.dst_port.as_ref().map(<PortRange as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Redirect {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PortRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(PortRange));
fidl::decode!(PortRange, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl Routine {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.type_ {
return 2;
}
if let Some(_) = self.id {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Routine {
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 Routine {
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<Routine> for &Routine {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Routine>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<RoutineId>(
self.id.as_ref().map(<RoutineId as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<RoutineType>(
self.type_.as_ref().map(<RoutineType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Routine {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(RoutineId));
fidl::decode!(RoutineId, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<RoutineType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.type_.get_or_insert_with(|| fidl::new_empty!(RoutineType));
fidl::decode!(RoutineType, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl TcpMatcher {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.dst_port {
return 2;
}
if let Some(_) = self.src_port {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for TcpMatcher {
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 TcpMatcher {
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<TcpMatcher> for &TcpMatcher {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TcpMatcher>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PortMatcher>(
self.src_port
.as_ref()
.map(<PortMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PortMatcher>(
self.dst_port
.as_ref()
.map(<PortMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TcpMatcher {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PortMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(PortMatcher));
fidl::decode!(PortMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PortMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(PortMatcher));
fidl::decode!(PortMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl UdpMatcher {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.dst_port {
return 2;
}
if let Some(_) = self.src_port {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for UdpMatcher {
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 UdpMatcher {
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<UdpMatcher> for &UdpMatcher {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UdpMatcher>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PortMatcher>(
self.src_port
.as_ref()
.map(<PortMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PortMatcher>(
self.dst_port
.as_ref()
.map(<PortMatcher as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for UdpMatcher {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PortMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(PortMatcher));
fidl::decode!(PortMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PortMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(PortMatcher));
fidl::decode!(PortMatcher, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl WatcherOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
unsafe impl fidl::encoding::TypeMarker for WatcherOptions {
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 WatcherOptions {
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<WatcherOptions> for &WatcherOptions {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WatcherOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for WatcherOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Action {
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 Action {
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<Action> for &Action {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Action>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Action::Accept(ref val) => fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Action::Drop(ref val) => fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Action::Jump(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<255>,
>(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
Action::Return_(ref val) => fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Action::TransparentProxy(ref val) => {
fidl::encoding::encode_in_envelope::<TransparentProxy_>(
<TransparentProxy_ as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Action::Redirect(ref val) => fidl::encoding::encode_in_envelope::<Redirect>(
<Redirect as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Action::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for Action {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => {
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => {
<TransparentProxy_ as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
6 => <Redirect as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 Action::Accept(_) = self {
} else {
*self = Action::Accept(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Action::Accept(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Action::Drop(_) = self {
} else {
*self = Action::Drop(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Action::Drop(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Action::Jump(_) = self {
} else {
*self = Action::Jump(fidl::new_empty!(fidl::encoding::BoundedString<255>));
}
#[allow(irrefutable_let_patterns)]
if let Action::Jump(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Action::Return_(_) = self {
} else {
*self = Action::Return_(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Action::Return_(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let Action::TransparentProxy(_) = self {
} else {
*self = Action::TransparentProxy(fidl::new_empty!(TransparentProxy_));
}
#[allow(irrefutable_let_patterns)]
if let Action::TransparentProxy(ref mut val) = self {
fidl::decode!(TransparentProxy_, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let Action::Redirect(_) = self {
} else {
*self = Action::Redirect(fidl::new_empty!(Redirect));
}
#[allow(irrefutable_let_patterns)]
if let Action::Redirect(ref mut val) = self {
fidl::decode!(Redirect, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Action::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for AddressMatcherType {
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 AddressMatcherType {
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<AddressMatcherType> for &AddressMatcherType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AddressMatcherType>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
AddressMatcherType::Subnet(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_net::Subnet>(
<fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AddressMatcherType::Range(ref val) => {
fidl::encoding::encode_in_envelope::<AddressRange>(
<AddressRange as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
AddressMatcherType::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for AddressMatcherType {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <fidl_fuchsia_net::Subnet as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <AddressRange as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 AddressMatcherType::Subnet(_) = self {
} else {
*self =
AddressMatcherType::Subnet(fidl::new_empty!(fidl_fuchsia_net::Subnet));
}
#[allow(irrefutable_let_patterns)]
if let AddressMatcherType::Subnet(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_net::Subnet,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let AddressMatcherType::Range(_) = self {
} else {
*self = AddressMatcherType::Range(fidl::new_empty!(AddressRange));
}
#[allow(irrefutable_let_patterns)]
if let AddressMatcherType::Range(ref mut val) = self {
fidl::decode!(AddressRange, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = AddressMatcherType::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for Change {
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 Change {
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<Change> for &Change {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Change>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Change::Create(ref val) => fidl::encoding::encode_in_envelope::<Resource>(
<Resource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Change::Remove(ref val) => fidl::encoding::encode_in_envelope::<ResourceId>(
<ResourceId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Change::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for Change {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <Resource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <ResourceId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 Change::Create(_) = self {
} else {
*self = Change::Create(fidl::new_empty!(Resource));
}
#[allow(irrefutable_let_patterns)]
if let Change::Create(ref mut val) = self {
fidl::decode!(Resource, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Change::Remove(_) = self {
} else {
*self = Change::Remove(fidl::new_empty!(ResourceId));
}
#[allow(irrefutable_let_patterns)]
if let Change::Remove(ref mut val) = self {
fidl::decode!(ResourceId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Change::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for ChangeValidationResult {
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 ChangeValidationResult {
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<ChangeValidationResult> for &mut ChangeValidationResult {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChangeValidationResult>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ChangeValidationResult::Ok(ref val) => {
fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
ChangeValidationResult::TooManyChanges(ref val) => {
fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
ChangeValidationResult::ErrorOnChange(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<ChangeValidationError, 42>>(
<fidl::encoding::Vector<ChangeValidationError, 42> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
ChangeValidationResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for ChangeValidationResult {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <fidl::encoding::Vector<ChangeValidationError, 42> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 ChangeValidationResult::Ok(_) = self {
} else {
*self = ChangeValidationResult::Ok(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let ChangeValidationResult::Ok(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ChangeValidationResult::TooManyChanges(_) = self {
} else {
*self = ChangeValidationResult::TooManyChanges(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let ChangeValidationResult::TooManyChanges(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let ChangeValidationResult::ErrorOnChange(_) = self {
} else {
*self = ChangeValidationResult::ErrorOnChange(
fidl::new_empty!(fidl::encoding::Vector<ChangeValidationError, 42>),
);
}
#[allow(irrefutable_let_patterns)]
if let ChangeValidationResult::ErrorOnChange(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<ChangeValidationError, 42>, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = ChangeValidationResult::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for CommitResult {
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 CommitResult {
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<CommitResult> for &mut CommitResult {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommitResult>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
CommitResult::Ok(ref val) => {
fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
CommitResult::RuleWithInvalidMatcher(ref val) => {
fidl::encoding::encode_in_envelope::<RuleId>(
<RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
CommitResult::RuleWithInvalidAction(ref val) => {
fidl::encoding::encode_in_envelope::<RuleId>(
<RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
CommitResult::CyclicalRoutineGraph(ref val) => {
fidl::encoding::encode_in_envelope::<RoutineId>(
<RoutineId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
CommitResult::ErrorOnChange(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<CommitError, 1024>>(
<fidl::encoding::Vector<CommitError, 1024> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
CommitResult::TransparentProxyWithInvalidMatcher(ref val) => {
fidl::encoding::encode_in_envelope::<RuleId>(
<RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
CommitResult::RedirectWithInvalidMatcher(ref val) => {
fidl::encoding::encode_in_envelope::<RuleId>(
<RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
CommitResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for CommitResult {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <fidl::encoding::Vector<CommitError, 1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 CommitResult::Ok(_) = self {
} else {
*self = CommitResult::Ok(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let CommitResult::Ok(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let CommitResult::RuleWithInvalidMatcher(_) = self {
} else {
*self = CommitResult::RuleWithInvalidMatcher(fidl::new_empty!(RuleId));
}
#[allow(irrefutable_let_patterns)]
if let CommitResult::RuleWithInvalidMatcher(ref mut val) = self {
fidl::decode!(RuleId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let CommitResult::RuleWithInvalidAction(_) = self {
} else {
*self = CommitResult::RuleWithInvalidAction(fidl::new_empty!(RuleId));
}
#[allow(irrefutable_let_patterns)]
if let CommitResult::RuleWithInvalidAction(ref mut val) = self {
fidl::decode!(RuleId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let CommitResult::CyclicalRoutineGraph(_) = self {
} else {
*self = CommitResult::CyclicalRoutineGraph(fidl::new_empty!(RoutineId));
}
#[allow(irrefutable_let_patterns)]
if let CommitResult::CyclicalRoutineGraph(ref mut val) = self {
fidl::decode!(RoutineId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let CommitResult::ErrorOnChange(_) = self {
} else {
*self = CommitResult::ErrorOnChange(
fidl::new_empty!(fidl::encoding::Vector<CommitError, 1024>),
);
}
#[allow(irrefutable_let_patterns)]
if let CommitResult::ErrorOnChange(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<CommitError, 1024>, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let CommitResult::TransparentProxyWithInvalidMatcher(_) = self {
} else {
*self = CommitResult::TransparentProxyWithInvalidMatcher(fidl::new_empty!(
RuleId
));
}
#[allow(irrefutable_let_patterns)]
if let CommitResult::TransparentProxyWithInvalidMatcher(ref mut val) = self {
fidl::decode!(RuleId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
7 => {
#[allow(irrefutable_let_patterns)]
if let CommitResult::RedirectWithInvalidMatcher(_) = self {
} else {
*self = CommitResult::RedirectWithInvalidMatcher(fidl::new_empty!(RuleId));
}
#[allow(irrefutable_let_patterns)]
if let CommitResult::RedirectWithInvalidMatcher(ref mut val) = self {
fidl::decode!(RuleId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = CommitResult::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for Event {
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 Event {
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<Event> for &Event {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Event>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Event::Existing(ref val) => fidl::encoding::encode_in_envelope::<ExistingResource>(
<ExistingResource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Event::Added(ref val) => fidl::encoding::encode_in_envelope::<AddedResource>(
<AddedResource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Event::Removed(ref val) => fidl::encoding::encode_in_envelope::<RemovedResource>(
<RemovedResource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Event::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Event::EndOfUpdate(ref val) => fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Event::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for Event {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <ExistingResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <AddedResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <RemovedResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 Event::Existing(_) = self {
} else {
*self = Event::Existing(fidl::new_empty!(ExistingResource));
}
#[allow(irrefutable_let_patterns)]
if let Event::Existing(ref mut val) = self {
fidl::decode!(ExistingResource, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Event::Added(_) = self {
} else {
*self = Event::Added(fidl::new_empty!(AddedResource));
}
#[allow(irrefutable_let_patterns)]
if let Event::Added(ref mut val) = self {
fidl::decode!(AddedResource, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Event::Removed(_) = self {
} else {
*self = Event::Removed(fidl::new_empty!(RemovedResource));
}
#[allow(irrefutable_let_patterns)]
if let Event::Removed(ref mut val) = self {
fidl::decode!(RemovedResource, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Event::Idle(_) = self {
} else {
*self = Event::Idle(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Event::Idle(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let Event::EndOfUpdate(_) = self {
} else {
*self = Event::EndOfUpdate(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Event::EndOfUpdate(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Event::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for InterfaceMatcher {
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 InterfaceMatcher {
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<InterfaceMatcher> for &InterfaceMatcher {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InterfaceMatcher>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
InterfaceMatcher::Id(ref val) => {
fidl::encoding::encode_in_envelope::<u64>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
InterfaceMatcher::Name(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<15>>(
<fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
InterfaceMatcher::PortClass(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_interfaces::PortClass>(
<fidl_fuchsia_net_interfaces::PortClass as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
InterfaceMatcher::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for InterfaceMatcher {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <fidl_fuchsia_net_interfaces::PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 InterfaceMatcher::Id(_) = self {
} else {
*self = InterfaceMatcher::Id(fidl::new_empty!(u64));
}
#[allow(irrefutable_let_patterns)]
if let InterfaceMatcher::Id(ref mut val) = self {
fidl::decode!(u64, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let InterfaceMatcher::Name(_) = self {
} else {
*self = InterfaceMatcher::Name(fidl::new_empty!(
fidl::encoding::BoundedString<15>
));
}
#[allow(irrefutable_let_patterns)]
if let InterfaceMatcher::Name(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<15>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let InterfaceMatcher::PortClass(_) = self {
} else {
*self = InterfaceMatcher::PortClass(fidl::new_empty!(
fidl_fuchsia_net_interfaces::PortClass
));
}
#[allow(irrefutable_let_patterns)]
if let InterfaceMatcher::PortClass(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_net_interfaces::PortClass,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = InterfaceMatcher::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for Resource {
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 Resource {
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<Resource> for &Resource {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Resource>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Resource::Namespace(ref val) => fidl::encoding::encode_in_envelope::<Namespace>(
<Namespace as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Resource::Routine(ref val) => fidl::encoding::encode_in_envelope::<Routine>(
<Routine as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Resource::Rule(ref val) => fidl::encoding::encode_in_envelope::<Rule>(
<Rule as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Resource::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for Resource {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <Namespace as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <Routine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <Rule as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 Resource::Namespace(_) = self {
} else {
*self = Resource::Namespace(fidl::new_empty!(Namespace));
}
#[allow(irrefutable_let_patterns)]
if let Resource::Namespace(ref mut val) = self {
fidl::decode!(Namespace, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Resource::Routine(_) = self {
} else {
*self = Resource::Routine(fidl::new_empty!(Routine));
}
#[allow(irrefutable_let_patterns)]
if let Resource::Routine(ref mut val) = self {
fidl::decode!(Routine, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Resource::Rule(_) = self {
} else {
*self = Resource::Rule(fidl::new_empty!(Rule));
}
#[allow(irrefutable_let_patterns)]
if let Resource::Rule(ref mut val) = self {
fidl::decode!(Rule, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Resource::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for ResourceId {
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 ResourceId {
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<ResourceId> for &ResourceId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ResourceId>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ResourceId::Namespace(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<255>,
>(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
ResourceId::Routine(ref val) => fidl::encoding::encode_in_envelope::<RoutineId>(
<RoutineId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
ResourceId::Rule(ref val) => fidl::encoding::encode_in_envelope::<RuleId>(
<RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
ResourceId::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for ResourceId {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => {
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
2 => <RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 ResourceId::Namespace(_) = self {
} else {
*self = ResourceId::Namespace(fidl::new_empty!(
fidl::encoding::BoundedString<255>
));
}
#[allow(irrefutable_let_patterns)]
if let ResourceId::Namespace(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ResourceId::Routine(_) = self {
} else {
*self = ResourceId::Routine(fidl::new_empty!(RoutineId));
}
#[allow(irrefutable_let_patterns)]
if let ResourceId::Routine(ref mut val) = self {
fidl::decode!(RoutineId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let ResourceId::Rule(_) = self {
} else {
*self = ResourceId::Rule(fidl::new_empty!(RuleId));
}
#[allow(irrefutable_let_patterns)]
if let ResourceId::Rule(ref mut val) = self {
fidl::decode!(RuleId, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = ResourceId::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for RoutineType {
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 RoutineType {
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<RoutineType> for &RoutineType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RoutineType>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
RoutineType::Ip(ref val) => fidl::encoding::encode_in_envelope::<IpRoutine>(
<IpRoutine as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
RoutineType::Nat(ref val) => fidl::encoding::encode_in_envelope::<NatRoutine>(
<NatRoutine as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
RoutineType::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for RoutineType {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[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 => <IpRoutine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <NatRoutine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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 RoutineType::Ip(_) = self {
} else {
*self = RoutineType::Ip(fidl::new_empty!(IpRoutine));
}
#[allow(irrefutable_let_patterns)]
if let RoutineType::Ip(ref mut val) = self {
fidl::decode!(IpRoutine, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let RoutineType::Nat(_) = self {
} else {
*self = RoutineType::Nat(fidl::new_empty!(NatRoutine));
}
#[allow(irrefutable_let_patterns)]
if let RoutineType::Nat(ref mut val) = self {
fidl::decode!(NatRoutine, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = RoutineType::__SourceBreaking { unknown_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(())
}
}
unsafe impl fidl::encoding::TypeMarker for TransparentProxy_ {
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 TransparentProxy_ {
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<TransparentProxy_> for &TransparentProxy_ {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TransparentProxy_>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
TransparentProxy_::LocalAddr(ref val) => fidl::encoding::encode_in_envelope::<
fidl_fuchsia_net::IpAddress,
>(
<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
TransparentProxy_::LocalPort(ref val) => fidl::encoding::encode_in_envelope::<u16>(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
TransparentProxy_::LocalAddrAndPort(ref val) => {
fidl::encoding::encode_in_envelope::<SocketAddr>(
<SocketAddr as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
TransparentProxy_::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for TransparentProxy_ {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn