feat: streaming - #67
Open
ChildishForces wants to merge 5 commits into
Open
Conversation
Valerioageno
left a comment
Owner
There was a problem hiding this comment.
Summarizing here few comments:
- Please reduce/remove the inline comments. I think the repo should not act as documentation except for the
///docgen comments. The function name/types should be clear enough. I generally consider them AI slop that decrase the code readability rather than improving it. - Fix clippy and fmt
- The crate API should be smaller and more straightforward. Implementing usage level functions within the crate is not consistent with the philosopy of this crate. I think we should keep the
StreamSinktrait and a struct method for calling the streaming fn but the rest of the implementation should live outside.
Feel free to clone this repo in ossido if you think my comments are not helpful for it.
| InvalidJs(&'static str), | ||
| FailedToParseJs(&'static str), | ||
| FailedJsExecution(&'static str), | ||
| /// A rendered promise rejected (or the function threw). Carries the |
| Err(err) => return Err(err), | ||
| // Replaces a `Some(props).iter()...collect()` that iterated the | ||
| // `Option`, not the array, so it only ever registered the first | ||
| // property - fine when there's one export, wrong once `render` looks |
| /// lends for the duration of a streaming render (null at all other times). This | ||
| /// is how the bare V8 writer callback — which takes no captures — reaches the | ||
| /// caller's borrowed sink without any thread-local or `'static` state. | ||
| const SINK_SLOT: u32 = 0; |
Owner
There was a problem hiding this comment.
This memory allocation seems a thread_local! escape hatch. I think a correct API would be something like:
Ssr::from().render_streaming("renderStream", "__ssr_write", None, &mut |chunk: &str| print!("{chunk}"))?;SinkGuard and Streaming structs should not be part of this crate by keeping the interaction layer thinner.
| // the one still present here. If the slot no longer holds our pointer a | ||
| // guard failed to restore and the raw-pointer bridge is no longer sound | ||
| // - catch that in debug builds rather than read a stale pointer later. | ||
| debug_assert_eq!( |
Owner
There was a problem hiding this comment.
Is this a leftover, or is it meant to stay? I think debug is not needed in this crate outside development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.