mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Add setters to PassportElementError
This commit is contained in:
parent
d23c22b064
commit
08d6666698
1 changed files with 22 additions and 1 deletions
|
@ -14,7 +14,28 @@ pub struct PassportElementError {
|
||||||
kind: PassportElementErrorKind,
|
kind: PassportElementErrorKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use different types?
|
impl PassportElementError {
|
||||||
|
pub fn new<S>(message: S, kind: PassportElementErrorKind) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
Self { message: message.into(), kind }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn message<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.message = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn kind(mut self, val: PassportElementErrorKind) -> Self {
|
||||||
|
self.kind = val;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[serde(tag = "source")]
|
#[serde(tag = "source")]
|
||||||
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
|
Loading…
Reference in a new issue