Skip to content

Commit

Permalink
Fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DelSkayn committed Jul 11, 2023
1 parent 00a7d57 commit 3a5c140
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion core/src/context/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ unsafe impl<R> Send for WithFuture<'_, R> {}
/// // With the macro you can borrow the environment.
/// *some_var_ref += 1;
///
/// let delay = Func::new("delay", Async(delay));
/// let delay = Function::new(ctx,Async(delay))
/// .unwrap()
/// .with_name("print")
/// .unwrap();
///
/// let global = ctx.globals();
/// global.set("print",Func::from(print)).unwrap();
Expand Down
8 changes: 5 additions & 3 deletions core/src/persistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ use std::{
///
/// `Outlive<'js>` must be implemented for types the same, specific, lifetime 'js.
/// For example the following is unsound:
/// ```rust
/// ```no_run
/// # use rquickjs::Outlive;
/// struct Container<'js>(rquickjs::Object<'js>);
///
/// unsafe impl<'a,'js> Outlive<'js> for Object<'a>{
/// unsafe impl<'a,'js> Outlive<'js> for Container<'a>{
/// type Target<'to> = Container<'to>;
/// }
/// ```
/// Instead it must be implemented as following
/// ```
/// # use rquickjs::Outlive;
/// struct Container<'js>(rquickjs::Object<'js>);
///
/// unsafe impl<'js> Outlive<'js> for Object<'js>{
/// unsafe impl<'js> Outlive<'js> for Container<'js>{
/// type Target<'to> = Container<'to>;
/// }
/// ```
Expand Down

0 comments on commit 3a5c140

Please sign in to comment.