Skip to content
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

Add WeakRef::new() for creating a new, empty WeakRef #331

Merged
merged 2 commits into from May 4, 2018

Conversation

Projects
None yet
3 participants
@sdroege
Copy link
Member

sdroege commented May 4, 2018

No description provided.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented May 4, 2018

👍

unsafe {
let weak = WeakRef {
inner: Arc::new(WeakRefInner(mem::zeroed())),
thread: Some(thread::current().id()),

This comment has been minimized.

@tmiasko

tmiasko May 4, 2018

Contributor

None? It should be safe regardless of thread.

This comment has been minimized.

@sdroege

sdroege May 4, 2018

Author Member

True

@@ -963,6 +963,20 @@ pub struct WeakRef<T: ?Sized> {
marker: PhantomData<*const T>,
}

impl<T> WeakRef<T> {
pub fn new() -> Self {

This comment has been minimized.

@tmiasko

tmiasko May 4, 2018

Contributor

Maybe Default::default instead / in addition?

This comment has been minimized.

@sdroege

sdroege May 4, 2018

Author Member

Either would be fine. What would people prefer?

@sdroege

This comment has been minimized.

Copy link
Member Author

sdroege commented May 4, 2018

Updated

@sdroege

This comment has been minimized.

Copy link
Member Author

sdroege commented May 4, 2018

@GuillaumeGomez should be good to go :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented May 4, 2018

Indeed. Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 6206222 into gtk-rs:master May 4, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.