Skip to content

Commit

Permalink
remove extra functions
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Jan 22, 2025
1 parent 490a513 commit 52141f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 56 deletions.
30 changes: 9 additions & 21 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,15 @@ impl Client {
Some(network_address),
is_session_resumption,
) {
Ok(connection) => match request {
Request::Gemini(request) => connection
.gemini_request_async(
request,
priority,
cancellable,
move |result| match result {
Ok(response) => callback(Ok(response)),
Err(e) => callback(Err(Error::Connection(e))),
},
),
Request::Titan(request) => connection.titan_request_async(
request,
priority,
cancellable,
move |result| match result {
Ok(response) => callback(Ok(response)),
Err(e) => callback(Err(Error::Connection(e))),
},
),
},
Ok(connection) => connection.request_async(
request,
priority,
cancellable,
move |result| match result {
Ok(response) => callback(Ok(response)),
Err(e) => callback(Err(Error::Connection(e))),
},
),
Err(e) => callback(Err(Error::Connection(e))),
}
}
Expand Down
35 changes: 0 additions & 35 deletions src/client/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,41 +57,6 @@ impl Connection {
priority: Priority,
cancellable: Cancellable,
callback: impl FnOnce(Result<Response, Error>) + 'static,
) {
match request {
Request::Gemini(request) => {
self.gemini_request_async(request, priority, cancellable, callback)
}
Request::Titan(request) => {
self.titan_request_async(request, priority, cancellable, callback)
}
}
}

/// Make new request to `Self` connection using
/// [Gemini](https://geminiprotocol.net/docs/protocol-specification.gmi) protocol
/// * callback with new `Response` on success or `Error` on failure
/// * see also `request_async` method to send multi-protocol requests
pub fn gemini_request_async(
self,
request: Gemini,
priority: Priority,
cancellable: Cancellable,
callback: impl FnOnce(Result<Response, Error>) + 'static,
) {
self.bytes_request_async(&request.to_bytes(), priority, cancellable, callback);
}

/// Make new request to `Self` connection using
/// [Titan](gemini://transjovian.org/titan/page/The%20Titan%20Specification) protocol
/// * callback with new `Response` on success or `Error` on failure
/// * see also `request_async` method to send multi-protocol requests
pub fn titan_request_async(
self,
request: Titan,
priority: Priority,
cancellable: Cancellable,
callback: impl FnOnce(Result<Response, Error>) + 'static,
) {
self.bytes_request_async(&request.to_bytes(), priority, cancellable, callback);
}
Expand Down

0 comments on commit 52141f3

Please sign in to comment.