<div dir="ltr"><div>> My initial idea was to split the Handle -> Handle<'a> change in an own<br></div>> patch, to make it easier to review; unfortunately<div><br></div>Oh, I misunderstood what you meant. It is easy to use PhantomData. <div>Should I fix to use it? Or, it's ok to just mention the reason?<div><br></div><div>Note: the reason why Handle -> Handle<'a> is that without clarifying it,</div><div>rust compiler cannot infer how long the trait object of callbacks will live. </div><div>And then, it is considered as 'static lifetime. It is not useful for users, I think.</div><div><div><div><br></div><div>> So it means rust allows cyclic uses of modules/crates?</div><div><br></div><div>Yes. To my knowledge, it is available from Rust 2018.</div><div><br></div><div>> Remember the copyright/license in new files.</div><div><br></div><div>I forgot adding a license to the divided patch... I'll fix it if the patch </div><div>should be divided into two parts.</div><div><br></div><div>Regards,</div><div>Hiroyuki</div><div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2019年8月5日(月) 21:01 Pino Toscano <<a href="mailto:ptoscano@redhat.com" target="_blank">ptoscano@redhat.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Monday, 5 August 2019 08:59:31 CEST Hiroyuki Katsura wrote:<br>
> Without clarifying handle's lifetime, it is unable<br>
> to see how long the callbacks which the handle<br>
> owns will live. Then, Rust compiler will infer<br>
> that the callbacks have 'static lifetime. It is<br>
> not convenient for users.<br>
> ---<br>
<br>
My initial idea was to split the Handle -> Handle<'a> change in an own<br>
patch, to make it easier to review; unfortunately, doing this hits<br>
error E0392:<br>
<a href="https://doc.rust-lang.org/error-index.html#E0392" rel="noreferrer" target="_blank">https://doc.rust-lang.org/error-index.html#E0392</a><br>
So either this change goes together with other changes (like in this<br>
patch), or it uses PhantomData just to remove it after adding the<br>
callbacks. :-/<br>
<br>
I guess we can keep this patch as it is; please describe a bit more the<br>
addition of events, mentioning the Handle<'a> change is needed because<br>
<insert here what you already wrote as commit message>.<br>
<br>
> diff --git a/rust/src/<a href="http://base.rs" rel="noreferrer" target="_blank">base.rs</a> b/rust/src/<a href="http://base.rs" rel="noreferrer" target="_blank">base.rs</a><br>
> index 02ad33535..c17607cb3 100644<br>
> --- a/rust/src/<a href="http://base.rs" rel="noreferrer" target="_blank">base.rs</a><br>
> +++ b/rust/src/<a href="http://base.rs" rel="noreferrer" target="_blank">base.rs</a><br>
> @@ -17,6 +17,9 @@<br>
>   */<br>
>  <br>
>  use crate::error;<br>
> +use crate::event;<br>
> +use crate::guestfs;<br>
<br>
<a href="http://guestfs.rs" rel="noreferrer" target="_blank">guestfs.rs</a> has:<br>
use crate::base::*;<br>
<br>
So it means rust allows cyclic uses of modules/crates?<br>
<br>
> diff --git a/rust/src/<a href="http://event.rs" rel="noreferrer" target="_blank">event.rs</a> b/rust/src/<a href="http://event.rs" rel="noreferrer" target="_blank">event.rs</a><br>
> new file mode 100644<br>
> index 000000000..c363e913a<br>
> --- /dev/null<br>
> +++ b/rust/src/<a href="http://event.rs" rel="noreferrer" target="_blank">event.rs</a><br>
> @@ -0,0 +1,4 @@<br>
> +#[derive(Hash, PartialEq, Eq)]<br>
> +pub struct EventHandle {<br>
> +    eh: i32,<br>
> +}<br>
<br>
Remember the copyright/license in new files.<br>
<br>
-- <br>
Pino Toscano</blockquote></div></div></div></div></div></div>