pub enum FilterRejection {
NoBudgetAdvertised,
TooManyRanges {
ranges: usize,
limit: u64,
},
RepeatedFilter(u64, u8, Option<u64>),
Unreadable(RangeFilterError),
}Expand description
Why a peer’s request must be answered with REQUEST_ERROR and INVALID_FILTER.
Draft-20 gives the Range Filters four rules and answers every one of them
the same way — “MUST reject this with REQUEST_ERROR with error code
INVALID_FILTER” — so this says which rule was broken rather than which code
to send. FilterRejection::request_error_code is the code, and it is the
same for all four.
None of these is a session close, which is the whole reason the type exists. A rejection is a reply, and a reply names the Request ID of the request it answers, so the endpoint has to have taken the request in order to refuse it. The rejection is recorded against that id and spent by the REQUEST_ERROR that answers it.
Variants§
NoBudgetAdvertised
The peer sent a Range Filter and this endpoint advertised no budget.
Section 10.3.1.6: “The default value is 0, so if not specified, the peer MUST NOT send any such filter parameters.” Zero is the default and it means none allowed — the opposite of what zero means in the option beside it, MAX_REQUEST_UPDATES, where it means no limit. The two sit in consecutive subsections and read opposite ways.
TooManyRanges
More Ranges than MAX_FILTER_RANGES allows, counted across every filter.
RepeatedFilter(u64, u8, Option<u64>)
Two filters with the same Parameter Type, SetID and Property Type.
Repeats of a type are otherwise expected, so the key is the whole triple: “The Track Property filter parameter MAY appear multiple times in a SUBSCRIBE_TRACKS message”
Unreadable(RangeFilterError)
A filter this codec could not read, or one that broke a rule of its own.
Implementations§
Source§impl FilterRejection
impl FilterRejection
Sourcepub fn request_error_code(&self) -> RequestErrorCode
pub fn request_error_code(&self) -> RequestErrorCode
The REQUEST_ERROR code every one of these is answered with.
Trait Implementations§
Source§impl Clone for FilterRejection
impl Clone for FilterRejection
Source§fn clone(&self) -> FilterRejection
fn clone(&self) -> FilterRejection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FilterRejection
impl Debug for FilterRejection
Source§impl Display for FilterRejection
impl Display for FilterRejection
impl Eq for FilterRejection
Source§impl Error for FilterRejection
impl Error for FilterRejection
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()