1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Many improvements to the mas-http crate

- make `mas_http::client` implement Service directly instead of being
   an async function
 - a Get layer that makes a Service<Uri>
 - better error sources in the JSON layer
 - make the client have a proper error type
This commit is contained in:
Quentin Gliech
2022-02-15 08:28:25 +01:00
parent 497a3e006e
commit c5858e6ed5
10 changed files with 260 additions and 53 deletions

View File

@@ -12,19 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::layers::json::Json;
use crate::layers::{get::Get, json::Json};
pub trait ServiceExt {
fn json<T>(self) -> Json<Self, T>
where
Self: Sized;
pub trait ServiceExt: Sized {
fn json<T>(self) -> Json<Self, T>;
fn get(self) -> Get<Self>;
}
impl<S> ServiceExt for S {
fn json<T>(self) -> Json<Self, T>
where
Self: Sized,
{
fn json<T>(self) -> Json<Self, T> {
Json::new(self)
}
fn get(self) -> Get<Self> {
Get::new(self)
}
}