-
Notifications
You must be signed in to change notification settings - Fork 231
Open
Description
Quick drive-by issue just to note that this function doesn't behave like its comment says it does:
rustler/rustler/src/serde/atoms.rs
Lines 22 to 37 in ef20458
/** | |
* Attempts to create an atom term from the provided string (if the atom already exists in the atom table). If not, returns a string term. | |
*/ | |
pub fn str_to_term<'a>(env: &Env<'a>, string: &str) -> Result<Term<'a>, Error> { | |
if string == "Ok" { | |
Ok(ok().encode(*env)) | |
} else if string == "Err" { | |
Ok(error().encode(*env)) | |
} else { | |
match Atom::try_from_bytes(*env, string.as_bytes()) { | |
Ok(Some(term)) => Ok(term.encode(*env)), | |
Ok(None) => Err(Error::InvalidStringable), | |
_ => Err(Error::InvalidStringable), | |
} | |
} | |
} |
Specifically, it says it returns a string term if there isn't already an existing atom:
rustler/rustler/src/serde/atoms.rs
Line 23 in ef20458
* Attempts to create an atom term from the provided string (if the atom already exists in the atom table). If not, returns a string term. |
but then doesn't do that and just returns an error instead:
rustler/rustler/src/serde/atoms.rs
Line 33 in ef20458
Ok(None) => Err(Error::InvalidStringable), |
Metadata
Metadata
Assignees
Labels
No labels