summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhcpl <hcpl.prog@gmail.com>2017-06-08 01:36:24 +0300
committerhcpl <hcpl.prog@gmail.com>2017-06-08 01:36:24 +0300
commitf1e8c49ff44955ec219f99bae7bb635761c47eed (patch)
treeed7ab9da716aa2f25c04c81c394a7710baef3f9e
parent2e88dfbc24a9b1d963c5d50543838339a3b2f658 (diff)
Replace uses of try! to ? operator
-rw-r--r--README.md14
1 files changed, 7 insertions, 7 deletions
diff --git a/README.md b/README.md
index 931906c..8ea600e 100644
--- a/README.md
+++ b/README.md
@@ -330,13 +330,13 @@ Tables can be imported from and exported to **CSV**. This is possible thanks to
### Importing
A `Table` can be imported from a string:
```rust
-let table = try!(Table::from_csv_string("ABC,DEFG,HIJKLMN\n\
- foobar,bar,foo\n\
- foobar2,bar2,foo2"));
+let table = Table::from_csv_string("ABC,DEFG,HIJKLMN\n\
+ foobar,bar,foo\n\
+ foobar2,bar2,foo2")?;
```
or from CSV files:
```rust
-let table = try!(Table::from_csv_file("input_csv.txt"));
+let table = Table::from_csv_file("input_csv.txt")?;
```
> Those 2 ways of importing CSV assumes a CSV format with `no headers`, and delimited with `commas`
@@ -350,14 +350,14 @@ let table = Table::from_csv(reader);
### Exporting
Export to a generic `Write`:
```rust
-let out = try!(File::create("output_csv.txt"));
-try!(table.to_csv(out));
+let out = File::create("output_csv.txt")?;
+table.to_csv(out)?;
```
or to a `csv::Writer<W: Write>`:
```rust
let writer = /* create a writer */;
/* do something with the writer */
-try!(table.to_csv_writer(writer));
+table.to_csv_writer(writer)?;
```
## Note on line endings