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 weak referenced type WeakAddr<A> for actors #188

Merged
merged 5 commits into from Dec 18, 2018

Conversation

feisuzhu
Copy link
Contributor

Fixes #187

drop(addr1);

ctx.run_later(Duration::new(0, 1000), move |_, _| {
match weak1.upgrade() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about assert!(weak1.upgrade().is_none(), "Should not be able to upgrade dropped WeakAddr")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed :)

//
impl<A: Actor> WeakAddressSender<A> {
/// TODO
pub fn upgrade(&self) -> Option<AddressSender<A>> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a result instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axos88 std::rc::Weak does the same. And there is no other reason for a failed upgrade :)

Copy link
Contributor

@DoumanAsh DoumanAsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing your code made me think about addresses internals which I want to re-check before we're going ahead with it.

Otherwise it looks good

src/address/mod.rs Show resolved Hide resolved
Copy link
Contributor

@DoumanAsh DoumanAsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add please changelong entry for new type of Addr

//
//
impl<A: Actor> WeakAddressSender<A> {
pub fn upgrade(&self) -> Option<AddressSender<A>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add doc comment

}

impl<A: Actor> WeakAddr<A> {
pub fn upgrade(&self) -> Option<Addr<A>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add doc comment

CHANGES.md Outdated
@@ -1,5 +1,11 @@
# CHANGES

## [0.8.0] (2018-12-18)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it 0.7.x for now, it is not breaking change so there is no need to increment major version

Copy link
Contributor

@DoumanAsh DoumanAsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants