Skip to content

Conversation

@sunjay
Copy link
Contributor

@sunjay sunjay commented Feb 22, 2019

Hello again!
I added a constructor for AstNode so we don't have to go through 3 constructors every time just to create one.

The issue I'm addressing is that AstNode is Node<'a, RefCell<Ast>> which is three nested objects. That means to make one from a NodeValue, you have to use three constructors:

Node::new(RefCell::new(Ast::new(value)))

Rather than just make a utility function in my code, I thought it would be better to just add a constructor so you can do AstNode::from(value) instead.

If/when this gets merged, could you release a new patch version of comrak? Thanks as always! 😄 🎉

Documentation Screenshot

image

Copy link
Owner

@kivikakk kivikakk left a comment

Choose a reason for hiding this comment

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

👌 Thank you!

@kivikakk kivikakk merged commit b637229 into kivikakk:master Feb 24, 2019
@sunjay sunjay deleted the new-node branch February 24, 2019 22:43
@kivikakk
Copy link
Owner

@sunjay
Copy link
Contributor Author

sunjay commented Feb 24, 2019

Thank you so much! 😊

@kivikakk
Copy link
Owner

Just FYI (and I'm not sure this'll be relevant given how much time has passed), I'm planning to remove this From impl in 0.18 — with proper line/col tracking to come, I'm discouraging creating Asts with default (zero) values for these fields.

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.

2 participants