pub struct KiteResponse<T> {
pub status: String,
pub data: Option<T>,
pub message: String,
pub error_type: Option<String>,
}
Expand description
Standard KiteConnect API response wrapper
Fields§
§status: String
Response status (“success” or “error”)
data: Option<T>
Response data (None for error responses)
message: String
Response message
error_type: Option<String>
Error type (for error responses)
Implementations§
Source§impl<T> KiteResponse<T>
impl<T> KiteResponse<T>
Sourcepub fn error(message: impl Into<String>, error_type: Option<String>) -> Self
pub fn error(message: impl Into<String>, error_type: Option<String>) -> Self
Create a new error response
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the response is successful
Sourcepub fn into_result(self) -> KiteResult<T>
pub fn into_result(self) -> KiteResult<T>
Extract the data or return an error
Trait Implementations§
Source§impl<T: Clone> Clone for KiteResponse<T>
impl<T: Clone> Clone for KiteResponse<T>
Source§fn clone(&self) -> KiteResponse<T>
fn clone(&self) -> KiteResponse<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug> Debug for KiteResponse<T>
impl<T: Debug> Debug for KiteResponse<T>
Source§impl<'de, T> Deserialize<'de> for KiteResponse<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for KiteResponse<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<RawResponse> for KiteResponse<Value>
impl From<RawResponse> for KiteResponse<Value>
Source§fn from(raw: RawResponse) -> Self
fn from(raw: RawResponse) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> Freeze for KiteResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for KiteResponse<T>where
T: RefUnwindSafe,
impl<T> Send for KiteResponse<T>where
T: Send,
impl<T> Sync for KiteResponse<T>where
T: Sync,
impl<T> Unpin for KiteResponse<T>where
T: Unpin,
impl<T> UnwindSafe for KiteResponse<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