Struct advent_solutions::advent2017::day07::Node
[−]
[src]
pub struct Node<'a> { /* fields omitted */ }You offer to help, but first you need to understand the structure of these towers. You ask each program to yell out their name, their weight, and (if they're holding a disc) the names of the programs immediately above them balancing on that disc. You write this information down (your puzzle input). Unfortunately, in their panic, they don't do this in an orderly fashion; by the time you're done, you're not sure which program gave which information.
For example, if your list is the following:
pbga (66)
xhth (57)
ebii (61)
havc (66)
ktlj (57)
fwft (72) -> ktlj, cntj, xhth
qoyq (66)
padx (45) -> pbga, havc, qoyq
tknk (41) -> ugml, padx, fwft
jptl (61)
ugml (68) -> gyxo, ebii, jptl
gyxo (61)
cntj (57)
...then you would be able to recreate the structure of the towers that looks like this:
gyxo
/
ugml - ebii
/ \
| jptl
|
| pbga
/ /
tknk --- padx - havc
\ \
| qoyq
|
| ktlj
\ /
fwft - cntj
\
xhth
In this example, tknk is at the bottom of the tower (the bottom
program), and is holding up ugml, padx, and fwft. Those programs
are, in turn, holding up other programs; in this example, none of those
programs are holding up any other programs, and are all the tops of
their own towers. (The actual tower balancing in front of you is much
larger.)
Methods
impl<'a> Node<'a>[src]
pub fn from_bytes(i: &[u8]) -> IResult<&[u8], Node, u32>
pub fn list_from_bytes(i: &[u8]) -> IResult<&[u8], Vec<Node>, u32>
Trait Implementations
impl<'a> Clone for Node<'a>[src]
fn clone(&self) -> Node<'a>[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl<'a> PartialEq for Node<'a>[src]
fn eq(&self, __arg_0: &Node<'a>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Node<'a>) -> bool[src]
This method tests for !=.
impl<'a> Eq for Node<'a>[src]
impl<'a> Debug for Node<'a>[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more