Skip to content

Commit 5580183

Browse files
rossoschwald
authored andcommitted
within example fixes
1 parent 2d8af90 commit 5580183

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/maxminddb/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,13 @@ impl<'de, S: AsRef<[u8]>> Reader<S> {
271271
/// use ipnetwork::IpNetwork;
272272
/// use maxminddb::{geoip2, Within};
273273
///
274-
/// let ip_net = IpNetwork::V6("::/0");
275-
/// let mut iter: Within<geoip2::City, _> = reader.within(ip_net).map_err(|e| e.to_string())?;
274+
/// let reader = maxminddb::Reader::open_readfile("test-data/test-data/GeoIP2-City-Test.mmdb").unwrap();
275+
///
276+
/// let ip_net = IpNetwork::V6("::/0".parse().unwrap());
277+
/// let mut iter: Within<geoip2::City, _> = reader.within(ip_net).unwrap();
276278
/// while let Some(next) = iter.next() {
277-
/// let item = next.map_err(|e| e.to_string())?;
278-
/// println!("ip_net={}, city={:?}", item.ip_net, city)
279+
/// let item = next.unwrap();
280+
/// println!("ip_net={}, city={:?}", item.ip_net, item.info);
279281
/// }
280282
/// ```
281283
pub fn within<T>(&'de self, cidr: IpNetwork) -> Result<Within<T, S>, MaxMindDBError>

0 commit comments

Comments
 (0)