-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing Decoder
trait to be more composable. (#938)
#1008
Conversation
Got 2 questions:
|
This one is not breaking
Yes. |
The documentation is not available anymore as the PR was closed or merged. |
fn decode(&self, tokens: Vec<String>) -> Result<String>; | ||
fn decode(&self, tokens: Vec<String>) -> Result<String> { | ||
let results = self.decode_chain(tokens)?; | ||
Ok(results.join("")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this line cause any problem for the SequenceDecoder?
Specifically, one unlikekly edge-case I'm thinking is: one of the sequence decoders is another sequence decoder, and Ok(results.join(""))
will cause an informaition loss (vec of str now just becomes a str)?
as a solution, we can implement fn decode
for Sequence Decoder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK I think.
The parent Sequence
would call the child Sequence.decode_chain
NOT the decode
function, so we're good, no ?
I could add a test to make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh I see, so it is no problem in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Decoder
trait to be more composable.