From bba1f8772100f870b9e49a81c56201d5ee66aad2 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 29 Sep 2013 22:22:10 -0700 Subject: [PATCH] Documentation fixes --- src/postgres/lib.rs | 13 +++++++++++-- src/postgres/types.rs | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/postgres/lib.rs b/src/postgres/lib.rs index 4e124c6e..a803d753 100644 --- a/src/postgres/lib.rs +++ b/src/postgres/lib.rs @@ -124,7 +124,7 @@ pub trait PostgresNoticeHandler { fn handle(&mut self, notice: PostgresDbError); } -/// A struct which handles notices by logging at the info level. +/// A notice handler which logs at the `info` level. /// /// This is the default handler used by a `PostgresConnection`. pub struct DefaultNoticeHandler; @@ -713,7 +713,7 @@ pub trait PostgresStatement { /// the parameters of the statement. fn try_update(&self, params: &[&ToSql]) -> Result; - /// A conveience function wrapping `try_update`. + /// A convenience function wrapping `try_update`. /// /// Fails if there was an error executing the statement. fn update(&self, params: &[&ToSql]) -> uint; @@ -1069,12 +1069,21 @@ impl<'self> Iterator> for PostgresResult<'self> { } /// A single result row of a query. +/// +/// A value can be accessed by the name or index of its column, though access +/// by index is more efficient. +/// +/// ```rust +/// let foo: i32 = row[0]; +/// let bar: ~str = row["bar"]; +/// ``` pub struct PostgresRow<'self> { priv stmt: &'self NormalPostgresStatement<'self>, priv data: ~[Option<~[u8]>] } impl<'self> Container for PostgresRow<'self> { + #[inline] fn len(&self) -> uint { self.data.len() } diff --git a/src/postgres/types.rs b/src/postgres/types.rs index 8f089b5a..cd6ec74c 100644 --- a/src/postgres/types.rs +++ b/src/postgres/types.rs @@ -119,7 +119,7 @@ macro_rules! check_types( ) ) -/// A trait for things that can be created from a Postgres value +/// A trait for types that can be created from a Postgres value pub trait FromSql { /// Creates a new value of this type from a buffer of Postgres data. ///