mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
rename method
This commit is contained in:
parent
bfc52606c3
commit
16af9499b5
3 changed files with 5 additions and 5 deletions
|
|
@ -17,7 +17,7 @@ cargo add ggemini
|
||||||
## `client`
|
## `client`
|
||||||
|
|
||||||
|
|
||||||
#### `client::simple_socket_request_async`
|
#### `client::single_socket_request_async`
|
||||||
|
|
||||||
High-level API to make async socket request and auto-close connection on complete.
|
High-level API to make async socket request and auto-close connection on complete.
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ use glib::{Uri, UriFlags};
|
||||||
// Parse URL string to valid URI
|
// Parse URL string to valid URI
|
||||||
match Uri::parse("gemini://geminiprotocol.net/", UriFlags::NONE) {
|
match Uri::parse("gemini://geminiprotocol.net/", UriFlags::NONE) {
|
||||||
// Begin async request
|
// Begin async request
|
||||||
Ok(uri) => ggemini::client::simple_socket_request_async(uri, |result| match result {
|
Ok(uri) => ggemini::client::single_socket_request_async(uri, |result| match result {
|
||||||
// Process response
|
// Process response
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
// Expect success status
|
// Expect success status
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use glib::Uri;
|
||||||
/// 3. read response
|
/// 3. read response
|
||||||
/// 4. close connection
|
/// 4. close connection
|
||||||
/// 5. return `Result<Response, Error>` to `callback` function
|
/// 5. return `Result<Response, Error>` to `callback` function
|
||||||
pub fn simple_socket_request_async(
|
pub fn single_socket_request_async(
|
||||||
uri: Uri,
|
uri: Uri,
|
||||||
callback: impl FnOnce(Result<Response, Error>) + 'static,
|
callback: impl FnOnce(Result<Response, Error>) + 'static,
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use glib::{Uri, UriFlags};
|
use glib::{Uri, UriFlags};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_socket_request_async() {
|
fn single_socket_request_async() {
|
||||||
// Parse URI
|
// Parse URI
|
||||||
match Uri::parse("gemini://geminiprotocol.net/", UriFlags::NONE) {
|
match Uri::parse("gemini://geminiprotocol.net/", UriFlags::NONE) {
|
||||||
// Begin async request
|
// Begin async request
|
||||||
Ok(uri) => ggemini::client::simple_socket_request_async(uri, |result| match result {
|
Ok(uri) => ggemini::client::single_socket_request_async(uri, |result| match result {
|
||||||
// Process response
|
// Process response
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
// Expect success status
|
// Expect success status
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue