client-api: Simplify Debug output for LoginInfo
This commit is contained in:
		
							parent
							
								
									28532f0726
								
							
						
					
					
						commit
						2b624c264e
					
				| @ -140,9 +140,9 @@ pub mod v3 { | |||||||
|     ///
 |     ///
 | ||||||
|     /// To construct the custom `LoginInfo` variant you first have to construct
 |     /// To construct the custom `LoginInfo` variant you first have to construct
 | ||||||
|     /// [`IncomingLoginInfo::new`] and then call [`IncomingLoginInfo::to_outgoing`] on it.
 |     /// [`IncomingLoginInfo::new`] and then call [`IncomingLoginInfo::to_outgoing`] on it.
 | ||||||
|     #[derive(Clone, Debug, Incoming, Serialize)] |     #[derive(Clone, Incoming, Serialize)] | ||||||
|     #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] |     #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] | ||||||
|     #[incoming_derive(!Deserialize)] |     #[incoming_derive(!Debug, !Deserialize)] | ||||||
|     #[serde(untagged)] |     #[serde(untagged)] | ||||||
|     pub enum LoginInfo<'a> { |     pub enum LoginInfo<'a> { | ||||||
|         /// An identifier and password are supplied to authenticate.
 |         /// An identifier and password are supplied to authenticate.
 | ||||||
| @ -158,6 +158,18 @@ pub mod v3 { | |||||||
|         _Custom(CustomLoginInfo<'a>), |         _Custom(CustomLoginInfo<'a>), | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     impl fmt::Debug for LoginInfo<'_> { | ||||||
|  |         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||||||
|  |             // Print `Password { .. }` instead of `Password(Password { .. })`
 | ||||||
|  |             match self { | ||||||
|  |                 Self::Password(inner) => inner.fmt(f), | ||||||
|  |                 Self::Token(inner) => inner.fmt(f), | ||||||
|  |                 Self::ApplicationService(inner) => inner.fmt(f), | ||||||
|  |                 Self::_Custom(inner) => inner.fmt(f), | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     impl IncomingLoginInfo { |     impl IncomingLoginInfo { | ||||||
|         /// Creates a new `IncomingLoginInfo` with the given `login_type` string, session and data.
 |         /// Creates a new `IncomingLoginInfo` with the given `login_type` string, session and data.
 | ||||||
|         ///
 |         ///
 | ||||||
| @ -199,6 +211,18 @@ pub mod v3 { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     impl fmt::Debug for IncomingLoginInfo { | ||||||
|  |         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||||||
|  |             // Print `Password { .. }` instead of `Password(Password { .. })`
 | ||||||
|  |             match self { | ||||||
|  |                 Self::Password(inner) => inner.fmt(f), | ||||||
|  |                 Self::Token(inner) => inner.fmt(f), | ||||||
|  |                 Self::ApplicationService(inner) => inner.fmt(f), | ||||||
|  |                 Self::_Custom(inner) => inner.fmt(f), | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     impl<'de> Deserialize<'de> for IncomingLoginInfo { |     impl<'de> Deserialize<'de> for IncomingLoginInfo { | ||||||
|         fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |         fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | ||||||
|         where |         where | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user