pub struct ResultObject<T> {
pub code: ResultCode,
pub data: Option<T>,
pub count: u64,
pub msg: String,
}Fields§
§code: ResultCode业务状态码:200=成功, 400=参数错误, 401=未认证, 403=禁止, 404=未找到, 500=内部错误
data: Option<T>业务数据
count: u64列表查询时的总记录数
msg: String消息
Implementations§
Source§impl<T> ResultObject<T>
impl<T> ResultObject<T>
pub fn success(data: T) -> Self
pub fn success_with_count(data: T, count: u64) -> Self
pub fn success_with_message(data: T, msg: impl Into<String>) -> Self
pub fn failure(error: ServiceError) -> Self
Trait Implementations§
Source§impl<T: Clone> Clone for ResultObject<T>
impl<T: Clone> Clone for ResultObject<T>
Source§fn clone(&self) -> ResultObject<T>
fn clone(&self) -> ResultObject<T>
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<T> ComposeSchema for ResultObject<T>where
T: ToSchema,
impl<T> ComposeSchema for ResultObject<T>where
T: ToSchema,
Source§impl<T: Debug> Debug for ResultObject<T>
impl<T: Debug> Debug for ResultObject<T>
Source§impl<T> Serialize for ResultObject<T>where
T: Serialize,
impl<T> Serialize for ResultObject<T>where
T: Serialize,
Auto Trait Implementations§
impl<T> Freeze for ResultObject<T>where
T: Freeze,
impl<T> RefUnwindSafe for ResultObject<T>where
T: RefUnwindSafe,
impl<T> Send for ResultObject<T>where
T: Send,
impl<T> Sync for ResultObject<T>where
T: Sync,
impl<T> Unpin for ResultObject<T>where
T: Unpin,
impl<T> UnsafeUnpin for ResultObject<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ResultObject<T>where
T: UnwindSafe,
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