Skip to main content

ODataLimits

Struct ODataLimits 

Source
pub struct ODataLimits {
    pub max_top: usize,
    pub max_orderby_fields: usize,
    pub max_filter_length: usize,
    pub require_signed_cursors: bool,
    pub cursor_hmac_key: Option<Vec<u8>>,
}
Expand description

Default configuration for OData input limits

Fields§

§max_top: usize

Maximum value for $top (default: 1000)

§max_orderby_fields: usize

Maximum number of fields in $orderby (default: 5)

§max_filter_length: usize

Maximum length of $filter expression in characters (default: 2000)

§require_signed_cursors: bool

Whether to enforce HMAC signing on cursors (default: false for now)

§cursor_hmac_key: Option<Vec<u8>>

HMAC key for cursor signing (if enabled)

Implementations§

Source§

impl ODataLimits

Source

pub fn new() -> Self

Create limits with custom values

Source

pub fn with_max_top(self, max_top: usize) -> Self

Set maximum $top value

Source

pub fn with_max_orderby_fields(self, max: usize) -> Self

Set maximum number of $orderby fields

Source

pub fn with_max_filter_length(self, max: usize) -> Self

Set maximum $filter length

Source

pub fn with_signed_cursors(self, key: Vec<u8>) -> Self

Enable HMAC-signed cursors with the given key

Source

pub fn validate_top(&self, top: usize) -> Result<(), Error>

Validate a $top value against limits.

§Errors

Returns Error::InvalidLimit if the top value exceeds the maximum allowed.

Source

pub fn validate_filter(&self, filter: &str) -> Result<(), Error>

Validate a $filter expression length.

§Errors

Returns Error::InvalidFilter if the filter expression exceeds the maximum length.

Source

pub fn validate_orderby_count(&self, count: usize) -> Result<(), Error>

Validate number of $orderby fields.

§Errors

Returns Error::InvalidOrderByField if the count exceeds the maximum allowed fields.

Trait Implementations§

Source§

impl Clone for ODataLimits

Source§

fn clone(&self) -> ODataLimits

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ODataLimits

Source§

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

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

impl Default for ODataLimits

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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, 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.