-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Implemented an initial setup for the console API #76
Conversation
@emwalker Thanks for the feedback. I've implemented the suggestions, and will try to implement the rest of the code. I might even check if it would be possible if I could create some node.js bindings, to see if I can use it from node.js, but this depends on my time available (i really want the parser done) |
impl Write for Buffer { | ||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { | ||
self.buf.extend(buf); | ||
Ok(buf.len()) |
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.
Did you want to fix this return value before merging? If not, perhaps add a // TODO: return correct return value
.
LGTM with suggestion. |
This is an initial setup of the console api, since i cannot spend any time on the parser since I cannot access the code (don't ask).
So therefor, I did some reading up on the console API, and found that it's not very hard to implement. Not everything is done yet, but most is.
The idea is that anything that can be displayed (implements fmt::Display), can be added to the console functions. It also contains timers, and groups.
Ultimately, the console will write to a io::Write, which can be stdout(), a file, or a string buffer. Later on, these calls will be connected to javascript methods.
I'm not sure if this is the right way to do it, so i'm hoping from some feedback from others to see if this is the right way to do it.
(i know that the console api is not the highest priority, but it gave me some time to read into more stuff, and practice some rust)