pub struct TestViewSet { /* private fields */ }Expand description
Test ViewSet with configurable middleware support
Implementations§
Source§impl TestViewSet
impl TestViewSet
pub fn new(basename: impl Into<String>) -> Self
pub fn with_login_required(self, login_required: bool) -> Self
pub fn with_permissions(self, permissions: Vec<String>) -> Self
Sourcepub fn as_view(self) -> ViewSetBuilder<Self>
pub fn as_view(self) -> ViewSetBuilder<Self>
Convert ViewSet to Handler with action mapping
Trait Implementations§
Source§impl Clone for TestViewSet
impl Clone for TestViewSet
Source§fn clone(&self) -> TestViewSet
fn clone(&self) -> TestViewSet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TestViewSet
impl Debug for TestViewSet
Source§impl ViewSet for TestViewSet
impl ViewSet for TestViewSet
Source§fn get_basename(&self) -> &str
fn get_basename(&self) -> &str
Get the basename for URL routing
Source§fn dispatch<'life0, 'async_trait>(
&'life0 self,
_request: Request,
_action: Action,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dispatch<'life0, 'async_trait>(
&'life0 self,
_request: Request,
_action: Action,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dispatch request to appropriate action
Source§fn get_middleware(&self) -> Option<Arc<dyn ViewSetMiddleware>>
fn get_middleware(&self) -> Option<Arc<dyn ViewSetMiddleware>>
Get middleware for this ViewSet
Returns None if no middleware is configured
Source§fn requires_login(&self) -> bool
fn requires_login(&self) -> bool
Check if login is required for this ViewSet
Source§fn get_required_permissions(&self) -> Vec<String>
fn get_required_permissions(&self) -> Vec<String>
Get required permissions for this ViewSet
Source§fn get_lookup_field(&self) -> &str
fn get_lookup_field(&self) -> &str
Get the lookup field for detail routes
Defaults to “id” if not overridden
Source§fn get_extra_actions(&self) -> Vec<ActionMetadata>
fn get_extra_actions(&self) -> Vec<ActionMetadata>
Dispatch request with dependency injection context Read more
Source§fn get_extra_action_url_map(&self) -> HashMap<String, String>
fn get_extra_action_url_map(&self) -> HashMap<String, String>
Get URL map for extra actions
Returns empty map for uninitialized ViewSets
Source§fn get_current_base_url(&self) -> Option<String>
fn get_current_base_url(&self) -> Option<String>
Get current base URL (only available after initialization)
Auto Trait Implementations§
impl Freeze for TestViewSet
impl RefUnwindSafe for TestViewSet
impl Send for TestViewSet
impl Sync for TestViewSet
impl Unpin for TestViewSet
impl UnsafeUnpin for TestViewSet
impl UnwindSafe for TestViewSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<V> InjectableViewSet for Vwhere
V: ViewSet,
impl<V> InjectableViewSet for Vwhere
V: ViewSet,
Source§fn resolve<'life0, 'life1, 'async_trait, T>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: Injectable + Clone + Send + Sync + 'static + 'async_trait,
Self: Sync + 'async_trait,
fn resolve<'life0, 'life1, 'async_trait, T>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: Injectable + Clone + Send + Sync + 'static + 'async_trait,
Self: Sync + 'async_trait,
Resolve a dependency from the request’s DI context with caching Read more
Source§fn resolve_uncached<'life0, 'life1, 'async_trait, T>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: Injectable + Clone + Send + Sync + 'static + 'async_trait,
Self: Sync + 'async_trait,
fn resolve_uncached<'life0, 'life1, 'async_trait, T>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: Injectable + Clone + Send + Sync + 'static + 'async_trait,
Self: Sync + 'async_trait,
Resolve a dependency from the request’s DI context without caching Read more
Source§fn try_resolve<'life0, 'life1, 'async_trait, T>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Option<T>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: Injectable + Clone + Send + Sync + 'static + 'async_trait,
Self: Sync + 'async_trait,
fn try_resolve<'life0, 'life1, 'async_trait, T>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Option<T>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: Injectable + Clone + Send + Sync + 'static + 'async_trait,
Self: Sync + 'async_trait,
Try to resolve a dependency, returning None if DI context is not available Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more