Posts

Showing posts from November 23, 2018

Marmara Ereğlisi

Image
For other locations of the same name, see Ereğli. Place in Tekirdağ, Turkey Marmara Ereğlisi Marmara Ereğlisi Coordinates: 40°58′11″N 27°57′19″E  /  40.96972°N 27.95528°E  / 40.96972; 27.95528 Coordinates: 40°58′11″N 27°57′19″E  /  40.96972°N 27.95528°E  / 40.96972; 27.95528 Country Turkey Province Tekirdağ Government  • Mayor İbrahim Uyan (CHP) Area [1]  • District 196.85 km 2 (76.00 sq mi) Population (2012) [2]  • Urban 10,325  • District 21,469  • District density 110/km 2 (280/sq mi) Website www.marmaraereglisi.bel.tr Location of Marmara Ereğli Promenade in Marmara Ereğlisi. Statue of Mustafa Kemal Atatürk in Marmara Ereğlisi. Marmara Ereğlisi is a town, located in a district bearing the same name, in Tekirdağ Province in the Marmara region of Turkey. The mayor was, as of January 2011 [update] , Uyan (CHP). Contents 1 Facts 2 History 3 Eski Ereğli 4 Holiday resorts 5 The t

What's the idiomatic way to convert a Result to a custom Fail impl?

Image
up vote 0 down vote favorite Currently, I'm turning a Result into an instance of my error enum that impls Fail like this: fn bbswitch_write(data: &str) -> Result<(), BbswitchError> { match fs::write("/proc/acpi/bbswitch", data) { Ok(_) => Ok(()), Err(e) => Err(BbswitchError::BbswitchNotAvailable { cause: e }.into()), } } but this feels very verbose, and I'd rather not write a four-line match statement every time I do something like this: let contents = fs::read_to_string("/proc/acpi/bbswitch").expect("bbswitch not available"); Is there something I'm doing wrong that's making error handling unreasonably difficult, or a way I could structure something better to make it more convenient? The rest of my code looks something like t