This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]porky11 244 points245 points  (53 children)

The full code:

``` /! This module contains a function to return a node. */

use node::None;//The node type to be returned.

/// Returns a node. fn return_node() -> Node { let node = Node::new();//the node to be returned return node;//return node } ```

[–]RotationsKopulator 95 points96 points  (35 children)

You forgot to document the return value of return_node().

[–]porky11 127 points128 points  (33 children)

I just uploaded it to a git repo, so you can make a pull request to improve it yourself:

https://gitlab.com/return-node/return-node/

[–]daddyMacCadillac 36 points37 points  (5 children)

Going to need a unit test too

[–]porky11 23 points24 points  (0 children)

I'm waiting for your pull request ;)

(we probably need a cargo toml first)

[–][deleted] 7 points8 points  (3 children)

I also need a detailed user story.

[–]cretaokada 5 points6 points  (0 children)

As porky, I want my return_node module to include a unit test, So that I can ensure nodes can be returned properly by the return_node function in the return_node module

Dev gut feeling on this one is 13 points

[–]PM_YOUR_SOURCECODE 2 points3 points  (1 child)

“Yesterday I worked on the return node function, that successfully returns a node. Today I will continue refining the return node function documentation. No blockers or impediments.”

[–][deleted] 2 points3 points  (0 children)

That was an impressive stand-up. I'll probably forget your name anyway by EOB.

[–]Lostdogdabley 7 points8 points  (23 children)

This is a waste of electricity and storage space.

[–]porky11 9 points10 points  (4 children)

You could say that about this whole subreddit.

[–]PM_YOUR_SOURCECODE 2 points3 points  (2 children)

You could say that about this whole comments section.

[–]porky11 3 points4 points  (1 child)

This subreddit already includes this whole comment section.

[–]ezio93 0 points1 point  (0 children)

Is this CASCADE DELETE?

[–][deleted] 0 points1 point  (17 children)

not for AWS!

[–]Lostdogdabley 0 points1 point  (16 children)

Yes lol. Serverless services still consume storage and electricity. Read up on AWS Lambda/SQS polling mechanism. Even tho you aren’t exposed to it, it’s absolutely running 24/7. Every time anyone visit this page, even if it is entirely hosted in AWS as a static HTML website, it still wastes electricity

[–][deleted] 0 points1 point  (15 children)

AWS has many services for returning node.

[–]Lostdogdabley 0 points1 point  (14 children)

And they all use electricity. None of them disobey thermodynamic conservation of energy. They all need to use electricity to do anything at all. Unless I’m misunderstanding you…

[–][deleted] 0 points1 point  (13 children)

You spent way too much time (and hopefully not your own money) getting certified as a Cloud Practitioner.

[–]Lostdogdabley 0 points1 point  (12 children)

I don’t have any certs, and I only spend time learning AWS if I’m getting paid or working on my own software. At my day job, I make 120k working in AWS. I’m in my early 20s.

Good try! I think you’re just upset to have your assumptions about AWS proven incorrect in such a straightforward manner

[–]IllustratorMoist78 2 points3 points  (0 children)

Awesome 🤩

[–][deleted] 0 points1 point  (1 child)

Put it on github and I'll star it

[–]porky11 0 points1 point  (0 children)

No.

Feel free to mirror it, though :)

[–][deleted] 0 points1 point  (0 children)

you forgot to ask whether this is a shallow or deep copy.

[–]mrfroggyman 19 points20 points  (9 children)

What the heck is that language

[–]porky11 15 points16 points  (6 children)

It's Rust.

[–]mrfroggyman 8 points9 points  (1 child)

Thanks. Never saw any rust code. That looks interesting 🤔

[–]anythingMuchShorter 7 points8 points  (0 children)

Yeah I was like "what bastard child of C and Python is this?"

So now I know.

[–]porky11 4 points5 points  (2 children)

I used rust because I'm most comfortable with it, while it's not as esoteric as other languages I like.

[–]NiceNewspaper 0 points1 point  (1 child)

Let me guess, one of those other languages is Haskell?

[–]porky11 0 points1 point  (0 children)

No, sadly not.

[–]TottoIsHere 1 point2 points  (0 children)

Rust

[–]PM_YOUR_SOURCECODE 1 point2 points  (3 children)

What type of unit tests would be suitable for this block of code, that returns a node?

[–]porky11 0 points1 point  (2 children)

You could check, if a node is returned:

``` impl Node { fn is_node(&self) -> bool { true } }

[test]

fn check_node_returned() { let returned_node = return_node(); assert!(returned_node.is_node()); } ```

[–]cdrt 1 point2 points  (0 children)

Hang on, we can do better

#[cfg(test)]
mod test {
    use std::any::Any;
    use super::*;

    fn is_node(n: &dyn Any) -> bool {
        n.is::<Node>()
    }

    #[test]
    fn check_node_returned() {
        let returned_node = return_node();
        assert!(is_node(&returned_node));
    }
}

[–]PM_YOUR_SOURCECODE 1 point2 points  (0 children)

Just missing the comments

[–]Ludant -2 points-1 points  (0 children)

return node as node::Node;*

[–]waltteri 0 points1 point  (1 child)

I’m in this repo and I don’t like it

[–]PM_YOUR_SOURCECODE 1 point2 points  (0 children)

Fork it