|
1 | 1 | use crate::{ |
2 | 2 | EnumFromStrParsingError, OptionFromStr, WpApiParamOrder, WpResponseString, |
3 | | - impl_as_query_value_for_new_type, impl_as_query_value_from_to_string, |
| 3 | + impl_as_query_value_from_to_string, |
4 | 4 | url_query::{ |
5 | 5 | AppendUrlQueryPairs, FromUrlQueryPairs, QueryPairs, QueryPairsExtension, UrlQueryPairsMap, |
6 | 6 | }, |
| 7 | + wp_content_i64_id, |
7 | 8 | }; |
8 | 9 | use serde::{Deserialize, Serialize}; |
9 | | -use std::{ |
10 | | - collections::HashMap, convert::Infallible, fmt::Display, num::ParseIntError, str::FromStr, |
11 | | -}; |
| 10 | +use std::{collections::HashMap, convert::Infallible, fmt::Display, str::FromStr}; |
12 | 11 | use strum_macros::IntoStaticStr; |
13 | 12 | use wp_contextual::WpContextual; |
14 | 13 |
|
@@ -403,30 +402,7 @@ pub struct UserDeleteResponse { |
403 | 402 | pub previous: UserWithEditContext, |
404 | 403 | } |
405 | 404 |
|
406 | | -impl_as_query_value_for_new_type!(UserId); |
407 | | -uniffi::custom_newtype!(UserId, i64); |
408 | | -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] |
409 | | -pub struct UserId(pub i64); |
410 | | - |
411 | | -impl FromStr for UserId { |
412 | | - type Err = ParseIntError; |
413 | | - |
414 | | - fn from_str(s: &str) -> Result<Self, Self::Err> { |
415 | | - s.parse().map(Self) |
416 | | - } |
417 | | -} |
418 | | - |
419 | | -impl std::fmt::Display for UserId { |
420 | | - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
421 | | - write!(f, "{}", self.0) |
422 | | - } |
423 | | -} |
424 | | - |
425 | | -impl From<i64> for UserId { |
426 | | - fn from(value: i64) -> Self { |
427 | | - Self(value) |
428 | | - } |
429 | | -} |
| 405 | +wp_content_i64_id!(UserId); |
430 | 406 |
|
431 | 407 | #[derive(Debug, Serialize, Deserialize, uniffi::Record, WpContextual)] |
432 | 408 | pub struct SparseUser { |
|
0 commit comments