Skip to main content

TunerError

Enum TunerError 

Source
#[non_exhaustive]
pub enum TunerError { PllNotLocked { freq_hz: u32, }, XtalIsZero, PllProgrammingFailed { backend: &'static str, freq_hz: u32, reason: &'static str, }, I2cTransferFailed { operation: &'static str, got: usize, expected: usize, }, ShadowCacheMiss { reg: u8, }, UnsupportedFilterBandwidth { mode: u8, }, InvalidGain { what: &'static str, detail: String, }, Context { context: &'static str, source: Box<TunerError>, }, }
Expand description

Typed sub-variant of RtlSdrError::Tuner.

Since 0.2, tuner-side failures carry this enum instead of a stringly-typed String. Consumers can match on the variants to discriminate failure modes (e.g. retry on PllNotLocked, fail-fast on XtalIsZero).

Some variants carry a &'static str backend field naming the IC family ("R82xx", "FC0012", "FC0013", "E4K", "FC2580"); use it to disambiguate when the same failure shape can happen on multiple ICs.

#[non_exhaustive] so adding a new variant in any future patch release is non-breaking. Per #16.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

PllNotLocked

PLL did not achieve lock for the requested LO frequency within the IC’s retry budget. Usually means the frequency is at an awkward divider boundary or the crystal/clock is misconfigured. Backends: R82xx, E4K.

Fields

§freq_hz: u32
§

XtalIsZero

The configured crystal reference is zero, which would divide-by-zero in PLL math. Backends: R82xx (general), FC2580 (more specifically “crystal frequency too low”).

§

PllProgrammingFailed

PLL programming failed for an IC-specific reason that doesn’t share a common shape with other backends. Catch- all for “no valid divider found”, “computed PLL value exceeds register range”, “VCO out of range”, etc. The reason carries a static diagnostic string identifying the specific failure.

Backends: R82xx, FC0012, FC0013, FC2580, E4K.

Fields

§backend: &'static str
§freq_hz: u32
§reason: &'static str
§

I2cTransferFailed

I2C transfer to the tuner returned fewer bytes than expected. operation names which step failed ("write", "read addr", "read data").

Fields

§operation: &'static str
§got: usize
§expected: usize
§

ShadowCacheMiss

R82xx: register read attempted before the shadow cache was populated. Indicates a programming error in the crate (caller used the helper before init), not a hardware fault.

Fields

§reg: u8
§

UnsupportedFilterBandwidth

FC2580: the configured filter-bandwidth mode index doesn’t match any supported bandwidth in the IC’s LUT. mode is the internal mode tag (not a Hz value).

Fields

§mode: u8
§

InvalidGain

Gain parameter out of valid range. what names the parameter ("E4K IF gain stage", "E4K mixer gain", "E4K enhancement gain", etc.) and detail is a human-readable specifier describing the bad value. Backends: E4K (the only IC with multi-stage gain that validates per stage).

Fields

§what: &'static str
§detail: String
§

Context

Operation context wrapper. Used to add a &'static str prefix (e.g. "filter calibration") to an inner TunerError without losing the typed inner variant. #[source] makes the inner error walkable via std::error::Error::source for consumers using anyhow-style chained-error UI.

Coverage caveat (per audit pass-2 #74): Context only wraps TunerError — by construction it can’t carry a Usb(rusb::Error) or DeviceLost from the same operation. The R82xx filter-calibration path uses this shape today: failures from the calibration’s tuner-side math get wrapped (Context { context: "filter calibration", source: ... }), but a USB transport error during the same calibration sequence propagates as a bare RtlSdrError::Usb(...) with no calibration-context breadcrumb. Consumers building diagnostic UIs should match on both shapes if they want full coverage of the “what was the device doing when it failed” question.

Fields

§context: &'static str
§source: Box<TunerError>

Trait Implementations§

Source§

impl Clone for TunerError

Source§

fn clone(&self) -> TunerError

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 Debug for TunerError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TunerError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for TunerError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<TunerError> for RtlSdrError

Source§

fn from(source: TunerError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for TunerError

Source§

fn eq(&self, other: &TunerError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for TunerError

Source§

impl StructuralPartialEq for TunerError

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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