Pure Programmer
Blue Matrix


Cluster Map

Project: Duration Class

Write a mutable class to represent a time duration. Your class should represent time durations in the following units: ns, µs, ms, s, min, hour, day, week, month, year. Use an enumeration to represent the time duration units. You should have a default constructor that sets the internal value to 0. Write a setter that takes a value and an enumeration value for units. Include a getter that takes an enumeration value for units and returns the value in that measurement unit.

Output
$ rustc DurationClass.rs error: expected identifier, found keyword `enum` --> DurationClass.rs:13:2 | 9 | struct Duration { | -------- while parsing this struct ... 13 | enum Unit { | ^^^^ expected identifier, found keyword error: unknown format trait `g` --> DurationClass.rs:113:29 | 113 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:114:29 | 114 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:115:29 | 115 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:116:29 | 116 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:117:29 | 117 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:118:29 | 118 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:119:29 | 119 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:120:29 | 120 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:121:29 | 121 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:122:29 | 122 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:126:29 | 126 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:127:29 | 127 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:128:29 | 128 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:129:29 | 129 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:130:29 | 130 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:131:29 | 131 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:132:29 | 132 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:133:29 | 133 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:134:29 | 134 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:135:29 | 135 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:139:29 | 139 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:140:29 | 140 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:141:29 | 141 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:142:29 | 142 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:143:29 | 143 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:144:29 | 144 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:145:29 | 145 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:146:29 | 146 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:147:29 | 147 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `g` --> DurationClass.rs:148:29 | 148 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0424]: expected value, found module `self` --> DurationClass.rs:34:3 | 33 | fn new() -> Duration { | --- this function doesn't have a `self` parameter 34 | self.value = 0; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 33 | fn new(&self) -> Duration { | +++++ error[E0412]: cannot find type `Unit` in this scope --> DurationClass.rs:36:19 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^ not found in this scope error[E0424]: expected value, found module `self` --> DurationClass.rs:40:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 40 | result = self.value * 1e9f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:43:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 43 | result = self.value * 1e6f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:46:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 46 | result = self.value * 1e3f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:49:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 49 | result = self.value; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:52:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 52 | result = self.value / 60.f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:55:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 55 | result = self.value / 60.f64 / 60.f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:58:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 58 | result = self.value / 60.f64 / 60.f64 / 24.f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:61:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 61 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 7.f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:64:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 64 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 30.4375f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0424]: expected value, found module `self` --> DurationClass.rs:67:14 | 36 | fn getValue(unit:Unit) -> f64 { | -------- this function doesn't have a `self` parameter ... 67 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 365.25f64; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 36 | fn getValue(&self, unit:Unit) -> f64 { | ++++++ error[E0412]: cannot find type `Unit` in this scope --> DurationClass.rs:72:30 | 72 | fn setValue(value:f64, unit:Unit) -> () { | ^^^^ not found in this scope error[E0424]: expected value, found module `self` --> DurationClass.rs:106:3 | 72 | fn setValue(value:f64, unit:Unit) -> () { | -------- this function doesn't have a `self` parameter ... 106 | self.value = result; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 72 | fn setValue(&self, value:f64, unit:Unit) -> () { | ++++++ error[E0308]: mismatched types --> DurationClass.rs:33:14 | 33 | fn new() -> Duration { | --- ^^^^^^^^ expected `Duration`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:37:26 | 37 | let mut result:f64 = 0.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 37 | let mut result:f64 = 0.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:52:30 | 52 | result = self.value / 60.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 52 | result = self.value / 60.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:55:30 | 55 | result = self.value / 60.f64 / 60.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 55 | result = self.value / 60.0f64 / 60.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:55:39 | 55 | result = self.value / 60.f64 / 60.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 55 | result = self.value / 60.f64 / 60.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:58:30 | 58 | result = self.value / 60.f64 / 60.f64 / 24.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 58 | result = self.value / 60.0f64 / 60.f64 / 24.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:58:39 | 58 | result = self.value / 60.f64 / 60.f64 / 24.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 58 | result = self.value / 60.f64 / 60.0f64 / 24.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:58:48 | 58 | result = self.value / 60.f64 / 60.f64 / 24.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 58 | result = self.value / 60.f64 / 60.f64 / 24.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:61:30 | 61 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 61 | result = self.value / 60.0f64 / 60.f64 / 24.f64 / 7.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:61:39 | 61 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 61 | result = self.value / 60.f64 / 60.0f64 / 24.f64 / 7.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:61:48 | 61 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 61 | result = self.value / 60.f64 / 60.f64 / 24.0f64 / 7.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:61:56 | 61 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 61 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 7.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:64:30 | 64 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 30.4375f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 64 | result = self.value / 60.0f64 / 60.f64 / 24.f64 / 30.4375f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:64:39 | 64 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 30.4375f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 64 | result = self.value / 60.f64 / 60.0f64 / 24.f64 / 30.4375f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:64:48 | 64 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 30.4375f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 64 | result = self.value / 60.f64 / 60.f64 / 24.0f64 / 30.4375f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:67:30 | 67 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 365.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 67 | result = self.value / 60.0f64 / 60.f64 / 24.f64 / 365.25f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:67:39 | 67 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 365.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 67 | result = self.value / 60.f64 / 60.0f64 / 24.f64 / 365.25f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:67:48 | 67 | result = self.value / 60.f64 / 60.f64 / 24.f64 / 365.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 67 | result = self.value / 60.f64 / 60.f64 / 24.0f64 / 365.25f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:73:26 | 73 | let mut result:f64 = 0.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 73 | let mut result:f64 = 0.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:88:25 | 88 | result = value * 60.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 88 | result = value * 60.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:91:25 | 91 | result = value * 60.f64 * 60.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 91 | result = value * 60.0f64 * 60.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:91:34 | 91 | result = value * 60.f64 * 60.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 91 | result = value * 60.f64 * 60.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:94:25 | 94 | result = value * 60.f64 * 60.f64 * 24.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 94 | result = value * 60.0f64 * 60.f64 * 24.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:94:34 | 94 | result = value * 60.f64 * 60.f64 * 24.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 94 | result = value * 60.f64 * 60.0f64 * 24.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:94:43 | 94 | result = value * 60.f64 * 60.f64 * 24.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 94 | result = value * 60.f64 * 60.f64 * 24.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:97:25 | 97 | result = value * 60.f64 * 60.f64 * 24.f64 * 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 97 | result = value * 60.0f64 * 60.f64 * 24.f64 * 7.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:97:34 | 97 | result = value * 60.f64 * 60.f64 * 24.f64 * 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 97 | result = value * 60.f64 * 60.0f64 * 24.f64 * 7.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:97:43 | 97 | result = value * 60.f64 * 60.f64 * 24.f64 * 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 97 | result = value * 60.f64 * 60.f64 * 24.0f64 * 7.f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:97:51 | 97 | result = value * 60.f64 * 60.f64 * 24.f64 * 7.f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 97 | result = value * 60.f64 * 60.f64 * 24.f64 * 7.0f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:100:25 | 100 | result = value * 60.f64 * 60.f64 * 24.f64 * 30.4375f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 100 | result = value * 60.0f64 * 60.f64 * 24.f64 * 30.4375f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:100:34 | 100 | result = value * 60.f64 * 60.f64 * 24.f64 * 30.4375f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 100 | result = value * 60.f64 * 60.0f64 * 24.f64 * 30.4375f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:100:43 | 100 | result = value * 60.f64 * 60.f64 * 24.f64 * 30.4375f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 100 | result = value * 60.f64 * 60.f64 * 24.0f64 * 30.4375f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:103:25 | 103 | result = value * 60.f64 * 60.f64 * 24.f64 * 365.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 103 | result = value * 60.0f64 * 60.f64 * 24.f64 * 365.25f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:103:34 | 103 | result = value * 60.f64 * 60.f64 * 24.f64 * 365.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 103 | result = value * 60.f64 * 60.0f64 * 24.f64 * 365.25f64; | + error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:103:43 | 103 | result = value * 60.f64 * 60.f64 * 24.f64 * 365.25f64; | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 103 | result = value * 60.f64 * 60.f64 * 24.0f64 * 365.25f64; | + error[E0599]: no method named `setValue` found for struct `Duration` in the current scope --> DurationClass.rs:112:4 | 9 | struct Duration { | --------------- method `setValue` not found for this struct ... 112 | d.setValue(1.23f64, Duration::Unit::sec); | --^^^^^^^^------------------------------ | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::setValue(d, 1.23f64, Duration::Unit::sec)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:72:2 | 72 | fn setValue(value:f64, unit:Unit) -> () { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:112:22 | 112 | d.setValue(1.23f64, Duration::Unit::sec); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 112 | d.setValue(1.23f64, <Duration as Example>::Unit::sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:113:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 113 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::ns)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:113:48 | 113 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 113 | println!("{}", format!("{0:g} ns", d.getValue(<Duration as Example>::Unit::ns))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:114:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 114 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::μs)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:114:48 | 114 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 114 | println!("{}", format!("{0:g} µs", d.getValue(<Duration as Example>::Unit::μs))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:115:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 115 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::ms)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:115:48 | 115 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 115 | println!("{}", format!("{0:g} ms", d.getValue(<Duration as Example>::Unit::ms))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:116:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 116 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::sec)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:116:49 | 116 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 116 | println!("{}", format!("{0:g} sec", d.getValue(<Duration as Example>::Unit::sec))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:117:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 117 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::min)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:117:49 | 117 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 117 | println!("{}", format!("{0:g} min", d.getValue(<Duration as Example>::Unit::min))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:118:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 118 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::hour)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:118:50 | 118 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 118 | println!("{}", format!("{0:g} hour", d.getValue(<Duration as Example>::Unit::hour))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:119:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 119 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::day)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:119:49 | 119 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 119 | println!("{}", format!("{0:g} day", d.getValue(<Duration as Example>::Unit::day))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:120:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 120 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::week)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:120:50 | 120 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 120 | println!("{}", format!("{0:g} week", d.getValue(<Duration as Example>::Unit::week))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:121:42 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 121 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | --^^^^^^^^----------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::month)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:121:51 | 121 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 121 | println!("{}", format!("{0:g} month", d.getValue(<Duration as Example>::Unit::month))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:122:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 122 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::year)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:122:50 | 122 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 122 | println!("{}", format!("{0:g} year", d.getValue(<Duration as Example>::Unit::year))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `setValue` found for struct `Duration` in the current scope --> DurationClass.rs:125:4 | 9 | struct Duration { | --------------- method `setValue` not found for this struct ... 125 | d.setValue(1.f64, Duration::Unit::year); | --^^^^^^^^----------------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::setValue(d, 1.f64, Duration::Unit::year)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:72:2 | 72 | fn setValue(value:f64, unit:Unit) -> () { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:125:15 | 125 | d.setValue(1.f64, Duration::Unit::year); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 125 | d.setValue(1.0f64, Duration::Unit::year); | + error[E0223]: ambiguous associated type --> DurationClass.rs:125:20 | 125 | d.setValue(1.f64, Duration::Unit::year); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 125 | d.setValue(1.f64, <Duration as Example>::Unit::year); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:126:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 126 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::ns)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:126:48 | 126 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 126 | println!("{}", format!("{0:g} ns", d.getValue(<Duration as Example>::Unit::ns))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:127:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 127 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::μs)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:127:48 | 127 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 127 | println!("{}", format!("{0:g} µs", d.getValue(<Duration as Example>::Unit::μs))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:128:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 128 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::ms)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:128:48 | 128 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 128 | println!("{}", format!("{0:g} ms", d.getValue(<Duration as Example>::Unit::ms))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:129:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 129 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::sec)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:129:49 | 129 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 129 | println!("{}", format!("{0:g} sec", d.getValue(<Duration as Example>::Unit::sec))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:130:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 130 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::min)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:130:49 | 130 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 130 | println!("{}", format!("{0:g} min", d.getValue(<Duration as Example>::Unit::min))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:131:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 131 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::hour)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:131:50 | 131 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 131 | println!("{}", format!("{0:g} hour", d.getValue(<Duration as Example>::Unit::hour))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:132:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 132 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::day)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:132:49 | 132 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 132 | println!("{}", format!("{0:g} day", d.getValue(<Duration as Example>::Unit::day))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:133:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 133 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::week)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:133:50 | 133 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 133 | println!("{}", format!("{0:g} week", d.getValue(<Duration as Example>::Unit::week))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:134:42 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 134 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | --^^^^^^^^----------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::month)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:134:51 | 134 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 134 | println!("{}", format!("{0:g} month", d.getValue(<Duration as Example>::Unit::month))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:135:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 135 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::year)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:135:50 | 135 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 135 | println!("{}", format!("{0:g} year", d.getValue(<Duration as Example>::Unit::year))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `setValue` found for struct `Duration` in the current scope --> DurationClass.rs:138:4 | 9 | struct Duration { | --------------- method `setValue` not found for this struct ... 138 | d.setValue(1.f64, Duration::Unit::ns); | --^^^^^^^^--------------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::setValue(d, 1.f64, Duration::Unit::ns)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:72:2 | 72 | fn setValue(value:f64, unit:Unit) -> () { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> DurationClass.rs:138:15 | 138 | d.setValue(1.f64, Duration::Unit::ns); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 138 | d.setValue(1.0f64, Duration::Unit::ns); | + error[E0223]: ambiguous associated type --> DurationClass.rs:138:20 | 138 | d.setValue(1.f64, Duration::Unit::ns); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 138 | d.setValue(1.f64, <Duration as Example>::Unit::ns); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:139:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 139 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::ns)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:139:48 | 139 | println!("{}", format!("{0:g} ns", d.getValue(Duration::Unit::ns))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 139 | println!("{}", format!("{0:g} ns", d.getValue(<Duration as Example>::Unit::ns))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:140:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 140 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::μs)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:140:48 | 140 | println!("{}", format!("{0:g} µs", d.getValue(Duration::Unit::μs))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 140 | println!("{}", format!("{0:g} µs", d.getValue(<Duration as Example>::Unit::μs))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:141:39 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 141 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | --^^^^^^^^-------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::ms)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:141:48 | 141 | println!("{}", format!("{0:g} ms", d.getValue(Duration::Unit::ms))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 141 | println!("{}", format!("{0:g} ms", d.getValue(<Duration as Example>::Unit::ms))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:142:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 142 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::sec)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:142:49 | 142 | println!("{}", format!("{0:g} sec", d.getValue(Duration::Unit::sec))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 142 | println!("{}", format!("{0:g} sec", d.getValue(<Duration as Example>::Unit::sec))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:143:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 143 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::min)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:143:49 | 143 | println!("{}", format!("{0:g} min", d.getValue(Duration::Unit::min))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 143 | println!("{}", format!("{0:g} min", d.getValue(<Duration as Example>::Unit::min))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:144:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 144 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::hour)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:144:50 | 144 | println!("{}", format!("{0:g} hour", d.getValue(Duration::Unit::hour))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 144 | println!("{}", format!("{0:g} hour", d.getValue(<Duration as Example>::Unit::hour))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:145:40 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 145 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | --^^^^^^^^--------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::day)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:145:49 | 145 | println!("{}", format!("{0:g} day", d.getValue(Duration::Unit::day))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 145 | println!("{}", format!("{0:g} day", d.getValue(<Duration as Example>::Unit::day))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:146:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 146 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::week)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:146:50 | 146 | println!("{}", format!("{0:g} week", d.getValue(Duration::Unit::week))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 146 | println!("{}", format!("{0:g} week", d.getValue(<Duration as Example>::Unit::week))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:147:42 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 147 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | --^^^^^^^^----------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::month)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:147:51 | 147 | println!("{}", format!("{0:g} month", d.getValue(Duration::Unit::month))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 147 | println!("{}", format!("{0:g} month", d.getValue(<Duration as Example>::Unit::month))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `getValue` found for struct `Duration` in the current scope --> DurationClass.rs:148:41 | 9 | struct Duration { | --------------- method `getValue` not found for this struct ... 148 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | --^^^^^^^^---------------------- | | | | | this is an associated function, not a method | help: use associated function syntax instead: `Duration::getValue(d, Duration::Unit::year)` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Duration` --> DurationClass.rs:36:2 | 36 | fn getValue(unit:Unit) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated type --> DurationClass.rs:148:50 | 148 | println!("{}", format!("{0:g} year", d.getValue(Duration::Unit::year))); | ^^^^^^^^^^^^^^ | help: if there were a trait named `Example` with associated type `Unit` implemented for `Duration`, you could use the fully-qualified path | 148 | println!("{}", format!("{0:g} year", d.getValue(<Duration as Example>::Unit::year))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:39:4 | 39 | Unit::ns => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:42:4 | 42 | Unit::μs => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:45:4 | 45 | Unit::ms => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:48:4 | 48 | Unit::sec => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:51:4 | 51 | Unit::min => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:54:4 | 54 | Unit::hour => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:57:4 | 57 | Unit::day => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:60:4 | 60 | Unit::week => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:63:4 | 63 | Unit::month => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:66:4 | 66 | Unit::year => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:75:4 | 75 | Unit::ns => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:78:4 | 78 | Unit::μs => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:81:4 | 81 | Unit::ms => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:84:4 | 84 | Unit::sec => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:87:4 | 87 | Unit::min => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:90:4 | 90 | Unit::hour => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:93:4 | 93 | Unit::day => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:96:4 | 96 | Unit::week => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:99:4 | 99 | Unit::month => { | ^^^^ use of undeclared type `Unit` error[E0433]: failed to resolve: use of undeclared type `Unit` --> DurationClass.rs:102:4 | 102 | Unit::year => { | ^^^^ use of undeclared type `Unit` error: aborting due to 168 previous errors Some errors have detailed explanations: E0223, E0308, E0412, E0424, E0433, E0599, E0610. For more information about an error, try `rustc --explain E0223`.

Solution