Skip to main content

NetError

Enum NetError 

Source
#[repr(C)]
pub enum NetError {
Show 14 variants Success = 0, NullPointer = -1, InvalidUtf8 = -2, InvalidJson = -3, InitFailed = -4, IngestionFailed = -5, PollFailed = -6, BufferTooSmall = -7, ShuttingDown = -8, IntOverflow = -9, MismatchedHandles = -10, InteriorNul = -11, InvalidArgument = -12, Unknown = -99,
}
Expand description

Error codes returned by FFI functions.

Copy because it is a fieldless #[repr(C)] enum that is passed by value everywhere already; having it lets the header-parity guard read each variant’s discriminant directly.

Variants§

§

Success = 0

Success (no error).

§

NullPointer = -1

Null pointer passed.

§

InvalidUtf8 = -2

Invalid UTF-8 string.

§

InvalidJson = -3

Invalid JSON.

§

InitFailed = -4

Initialization failed.

§

IngestionFailed = -5

Ingestion failed (backpressure).

§

PollFailed = -6

Poll failed.

§

BufferTooSmall = -7

Buffer too small.

§

ShuttingDown = -8

Shutting down.

§

IntOverflow = -9

Integer overflow: result does not fit in c_int.

§

MismatchedHandles = -10

Stream handle does not belong to the supplied node handle. Previously the send-family FFIs accepted any (stream, node) pair without verifying they were created from the same node, allowing silent cross-session traffic.

§

InteriorNul = -11

CString::new failure: the input bytes are valid UTF-8 by Rust’s String invariant but contain an interior NUL byte — and the C ABI cannot represent that, since C strings are NUL-terminated. Pre-fix this was reported as InvalidUtf8, which was wrong: the input is UTF-8-valid; it just has a NUL where C expects it not to. A binding reading the typed error and seeing “invalid UTF-8” would chase the wrong cause.

§

InvalidArgument = -12

Input deserialized cleanly but is semantically unusable — e.g. a scope filter whose kind is unrecognized, or whose required selector is missing / empty / an all-empty list.

Distinct from Self::InvalidJson, which means the bytes were not valid JSON at all. Reporting these as InvalidJson would send a caller looking for a syntax error that isn’t there — the same reasoning that made Self::InteriorNul its own code.

Returning an error rather than silently widening is the point: a narrowing filter that cannot narrow must fail closed.

§

Unknown = -99

Unknown error.

Trait Implementations§

Source§

impl Clone for NetError

Source§

fn clone(&self) -> NetError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NetError

Source§

impl From<NetError> for c_int

Source§

fn from(e: NetError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more