The From
trait is one of the most commonly used trait in the Rust programming language, it is used for converting a value from one type to another.
After you implement the From
trait for a type, you can then use into()
on the source type to convert this type to the target type.
Here's an example on a use case for the From
trait:
This code works because the Fahrenheit
struct implements the From
trait for the Celsius
struct. This allows us to convert a Fahrenheit
instance to a Celsius
instance using the into()
method. The explicit type annotation : Celsius
tells the compiler to turn it "into" a Celsius
instance.
Your task is to implement the From
trait for the following struct types:
These structs are called Tuple Structs, they are similar to regular structs but they have unnamed fields. You can access the fields of a tuple struct using the index of the field, e.g. Hours(1).0
will return 1
.
You need to implement the From
trait for the following conversions:
Minutes
to Hours
Hours
to Days
Minutes
to Days
Days
to Hours
Good luck!
carlos-quantexai
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here let hours = minutes.0 / 60; Hours(hours) }}// TODO: implement from hours to daysimpl From<Hours> for Days{ fn from(hours: Hours) -> Days{ let days = hours.0 / 24; Days(days) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days{ fn from(minutes: Minutes) -> Days{ let days = (minutes.0 / 60) / 24; Days(days) }}// TODO: implement from days to hoursimpl From<Days> for Hours{ fn from(days: Days) -> Hours{ let hours = days.0 * 24; Hours(hours) }}
Maki-SIO
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
ShileiShen
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Days(minutes.0 / 60 / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { // Implement the minute to hour conversion here Hours(days.0 * 24) }}
Mxn-ptr
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Days(minutes.0 / 1440) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { // Implement the minute to hour conversion here Hours(days.0 * 24) }}
widyaput
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0/60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0/24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Days::from(Hours::from(minutes)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { // Implement the minute to hour conversion here Hours(days.0*24) }}
yansq
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(minutes: Hours) -> Days { // Implement the minute to hour conversion here Days(minutes.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Days(minutes.0 / 60 / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(minutes: Days) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 * 24) }}
damonxue
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { assert!(minutes.0 >= 0); Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { assert!(hours.0 >= 0); Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { assert!(minutes.0 >= 0); Days(minutes.0 / 24 / 60) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { assert!(days.0 >= 0); Hours(days.0 * 24) }}
imzhongqi
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0 / 24) } }// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Hours::from(minutes).into() }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { // Implement the minute to hour conversion here Hours(days.0 * 24) } }
funny233-github
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
zelsazgh
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 /60) }}// TODO: implement from hours to daysimpl From<Hours> for Days{ fn from(hours:Hours) ->Days{ Days(hours.0/24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days{ fn from(minutes:Minutes) -> Days{ Days(minutes.0/1440) }}// TODO: implement from days to hoursimpl From<Days> for Hours{ fn from(days:Days)->Hours{ Hours(days.0*24) }}
jose-bernardo
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / (60 * 24)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
digitalresistor
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours((minutes.0 as f64 / 60.0).round_ties_even() as i32) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days((hours.0 as f64 / 24.0).round_ties_even() as i32) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days::from(Hours::from(minutes)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
radloffl
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { let hours: Hours = minutes.into(); let days: Days = hours.into(); return days; }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
crrodger
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here let hours: i32 = minutes.0 / 60; Hours(hours) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { let days: i32 = hours.0 / 24; Days(days) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { let days: i32 = minutes.0 / (60 * 24); Days(days) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { let hours = days.0 * 24; Hours(hours) }}
majesticalcreature
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(h: Hours) -> Days { Days(h.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(min: Minutes) -> Days { Days(min.0 / 1440) // 1440 = 24*60 }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(d: Days) -> Hours { Hours(d.0 * 24) }}
jhq223
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(value: Hours) -> Self { Self(value.0 / 24) }}impl From<Minutes> for Days { fn from(value: Minutes) -> Self { Self(value.0 / (24 * 60)) }}impl From<Days> for Hours { fn from(value: Days) -> Self { Self(value.0 * 24) }}
xbarnett
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
mk-comm
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0/60) // Implement the minute to hour conversion here }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0/24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0/1440) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0*24) }}// TODO: implement from hours to days// TODO: implement from minutes to days// TODO: implement from days to hours
Johnchoi913
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { let hours: Hours = minutes.into(); let days: Days = hours.into(); days }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
LaurentiuStoleriu
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { let H: Hours = Hours(minutes.0 / 60); H }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { let D: Days = Days(hours.0 / 24); D }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { let D: Days = Days(minutes.0 / 60 / 24); D }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { let H: Hours = Hours(days.0 * 24); H }}
matei
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { let hours: Hours = minutes.into(); let days: Days = hours.into(); days }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
sander-b-postnl
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / (60 * 24)) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
vvreutskiy
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / (60 * 24)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
debuti
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Self { Self(minutes.0/60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Self { Self(hours.0/24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Self { Days::from(Hours::from(minutes)) }}impl From<Days> for Hours { fn from(days: Days) -> Self { Self(days.0*24) }}
amassare
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0/60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours:Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0/24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Days(minutes.0/(24*60)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days:Days) -> Hours { // Implement the minute to hour conversion here Hours(days.0*24) }}
alexromanov
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here return Hours(minutes.0 / 60); }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { return Days(hours.0 / 24); }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { return Days((minutes.0 / 60) / 24); }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { return Hours(days.0 * 24); }}
IdoPort
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Days(minutes.0 / (60 * 24)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { // Implement the minute to hour conversion here Hours(days.0 * 24) }}
Ustin
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0/60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0/24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0/60/24) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0*24) }}
dylan-park
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(24 * days.0) }}
shankun
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 24 / 60) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
kyhou
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days((minutes.0 / 60) / 24) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
hhornbacher
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days::from(Hours::from(minutes)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
Xinoi
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0/60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0/24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0/1440) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0*24) }}
CianciuStyles
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days::from(Hours::from(minutes)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
ayushrawat10
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0/60 as i32) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0/24 as i32) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0/(60*24) as i32) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0*24) }}// TODO: implement from hours to days// TODO: implement from minutes to days// TODO: implement from days to hours
pbjarterot
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
masteryachty
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days::from(Hours::from(minutes)) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
morigs
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days::from(Hours::from(minutes)) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
damascussteel21
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days((minutes.0 / 60) / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
jtruong04
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
oneopane
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / (60 * 24)) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}// TODO: implement from hours to days// TODO: implement from minutes to days// TODO: implement from days to hours
abhiyan-chhetri
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { return Hours(minutes.0/60); }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0/24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(min: Minutes) -> Days { Days(min.0/(24*60)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
yurm04
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here Days(minutes.0 / 1440) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { // Implement the minute to hour conversion here Hours(days.0 * 24) }}
Aditeya
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Self(minutes.0/60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(h: Hours) -> Days { Self(h.0/24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Self(minutes.0/(24*60)) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(d: Days) -> Hours { Self(d.0*24) }}
edgarcnp
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 1440) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
Sommos
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here let hours = minutes.0 / 60; Hours(hours) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { // Implement the minute to hour conversion here let days = hours.0 / 24; Days(days) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { // Implement the minute to hour conversion here let days = (minutes.0 / 60) / 24; Days(days) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { // Implement the minute to hour conversion here let hours = days.0 * 24; Hours(hours) }}
wischi-chr
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { // Implement the minute to hour conversion here Hours(minutes.0 / 60) }}// TODO: implement from hours to daysimpl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}// TODO: implement from minutes to daysimpl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}// TODO: implement from days to hoursimpl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
slawlor
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(Minutes(minutes): Minutes) -> Self { Self(minutes / 60) }}impl From<Hours> for Days { fn from(Hours(hours): Hours) -> Self { Self(hours / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Self { Days::from(Hours::from(minutes)) }}impl From<Days> for Hours { fn from(Days(days): Days) -> Self { Self(days*24) }}
Burnus
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 1440) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}
tukantje
pub struct Minutes(pub i32);pub struct Hours(pub i32);pub struct Days(pub i32);impl From<Minutes> for Hours { fn from(minutes: Minutes) -> Hours { Hours(minutes.0 / 60) }}impl From<Hours> for Days { fn from(hours: Hours) -> Days { Days(hours.0 / 24) }}impl From<Minutes> for Days { fn from(minutes: Minutes) -> Days { Days(minutes.0 / 60 / 24) }}impl From<Days> for Hours { fn from(days: Days) -> Hours { Hours(days.0 * 24) }}