|
3 | 3 | //! More info [here](https://typesense.org/docs/0.20.0/api/api-keys.html).
|
4 | 4 |
|
5 | 5 | use base64::{engine::general_purpose::STANDARD as Base64Engine, Engine};
|
| 6 | +use core::fmt; |
6 | 7 | use hmac::{Hmac, Mac};
|
7 | 8 | use serde::{Deserialize, Serialize};
|
8 | 9 | use sha2::Sha256;
|
@@ -139,16 +140,16 @@ pub enum Actions {
|
139 | 140 | #[serde(rename = "*")]
|
140 | 141 | All,
|
141 | 142 | }
|
142 |
| -impl ToString for Actions { |
143 |
| - fn to_string(&self) -> String { |
| 143 | +impl fmt::Display for Actions { |
| 144 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
144 | 145 | match self {
|
145 |
| - Self::DocumentsAll => "documents:*".to_string(), |
146 |
| - Self::DocumentsSearch => "documents:search".to_string(), |
147 |
| - Self::DocumentsGet => "documents:get".to_string(), |
148 |
| - Self::CollectionsAll => "collections:*".to_string(), |
149 |
| - Self::CollectionsDelete => "collections:delete".to_string(), |
150 |
| - Self::CollectionsCreate => "collections:create".to_string(), |
151 |
| - Self::All => "*".to_string(), |
| 146 | + Self::DocumentsAll => write!(f, "documents:*"), |
| 147 | + Self::DocumentsSearch => write!(f, "documents:search"), |
| 148 | + Self::DocumentsGet => write!(f, "documents:get"), |
| 149 | + Self::CollectionsAll => write!(f, "collections:*"), |
| 150 | + Self::CollectionsDelete => write!(f, "collections:delete"), |
| 151 | + Self::CollectionsCreate => write!(f, "collections:create"), |
| 152 | + Self::All => write!(f, "*"), |
152 | 153 | }
|
153 | 154 | }
|
154 | 155 | }
|
|
0 commit comments