pub struct Client { /* private fields */ }Expand description
HTTP/1.1 client.
Wraps ove_http_client_t with automatic cleanup on drop.
Implementations§
Source§impl Client
impl Client
Sourcepub fn create(storage: &mut ClientStorage) -> Result<Self>
pub fn create(storage: &mut ClientStorage) -> Result<Self>
Create a client that works in both heap and zero-heap modes.
In heap mode, allocates via the RTOS heap. In zero-heap mode,
uses caller-provided storage. The borrow checker ensures the
storage outlives the client.
Sourcepub fn get(&self, url: &[u8]) -> Result<Response>
pub fn get(&self, url: &[u8]) -> Result<Response>
Perform an HTTP GET request.
url must be a null-terminated URL (e.g. b"http://example.com/path\0").
§Errors
Returns an error if the request fails at the transport or protocol level.
Sourcepub fn post(
&self,
url: &[u8],
content_type: &[u8],
body: &[u8],
) -> Result<Response>
pub fn post( &self, url: &[u8], content_type: &[u8], body: &[u8], ) -> Result<Response>
Perform an HTTP POST request.
url and content_type must be null-terminated byte strings.
§Errors
Returns an error if the request fails at the transport or protocol level.
Trait Implementations§
impl Send for Client
impl Sync for Client
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Unpin for Client
impl UnwindSafe for Client
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