You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// A secret which may be securely stored.#[derive(Serialize,Deserialize,Eq,PartialEq,Debug,Clone)]#[serde(tag = "store", content = "value")]pubenumStoredToken{Text(String),Keyring,}
In TOML, it looks like either
# matches!(x, StoredToken::Text { .. })
[cubes.store]
store = 'Text'value = 'abcdefghijklmnop'# matches!(x, StoredToken::Keyring)
[cubes.store]
store = 'Keyring'
Since the StoredToken::Keyring variant doesn't contain data, I am not sure how to use pyserde. I naively tried
SerdeError: Can not deserialize {'store': 'Keyring'} of type Dict into Union[str, Keyring].
Reasons:
Failed to deserialize into str: Not a type of str
Failed to deserialize into Keyring: Unsupported type: Dict
The text was updated successfully, but these errors were encountered:
I am trying to use
pyserde
for interoperability between a Rust project using serde and a Python project.In my Rust code, I have an
enum
which is similar toOption<String>
.https://github.com/FNNDSC/chrs/blob/841e3957232d199ba8662c2915d12744217fd3d1/chrs/src/login/tokenstore.rs#L18-L24
In TOML, it looks like either
Since the
StoredToken::Keyring
variant doesn't contain data, I am not sure how to usepyserde
. I naively triedIt doesn't work:
The text was updated successfully, but these errors were encountered: