cargo_api/api/crates/
crate_.rs

1use crate::api::Endpoint;
2use std::borrow::Cow;
3
4#[derive(Clone, Debug)]
5pub struct Crate<'a> {
6    name: Cow<'a, str>,
7}
8
9impl<'a> Crate<'a> {
10    pub fn new(name: Cow<'a, str>) -> Self {
11        Self { name }
12    }
13}
14
15impl<'a> Endpoint for Crate<'a> {
16    fn method(&self) -> http::Method {
17        http::Method::GET
18    }
19
20    fn endpoint(&self) -> Cow<'static, str> {
21        Cow::Owned(format!("v1/crates/{}", self.name))
22    }
23}
24
25#[cfg(test)]
26mod tests {
27    //
28    // #[test]
29    // fn id() {
30    // }
31}