Check doc code blocks

This commit is contained in:
Steven Fackler 2014-03-08 22:01:24 -08:00
parent a8cf28d428
commit 3760a98528
3 changed files with 18 additions and 23 deletions

View File

@ -4,23 +4,6 @@ export RUSTFLAGS := -O --cfg ndebug
BUILDDIR := build BUILDDIR := build
INSTALL_DIR := %PREFIX% INSTALL_DIR := %PREFIX%
###############################################################################
# Reconfiguration
###############################################################################
CONFIGURE_ARGS := %CONFIGURE_ARGS%
NEED_GIT_RECONFIG := $(shell git submodule status | grep -c '^\(+|-\)')
ifeq ($(NEED_GIT_RECONFIG),0)
else
.PHONY: config.stamp
endif
Makefile: config.stamp
config.stamp: configure Makefile.in
./configure $(CONFIGURE_ARGS)
############################################################################### ###############################################################################
# Dependencies # Dependencies
############################################################################### ###############################################################################
@ -71,8 +54,10 @@ all: $(POSTGRES_LIB)
############################################################################### ###############################################################################
# Utility # Utility
############################################################################### ###############################################################################
check-doc: $(POSTGRES_LIB)
$(RUSTDOC) $(LINK_ARGS) -L $(BUILDDIR) --test $(POSTGRES_LIB_FILE)
check: $(POSTGRES_TEST) check: $(POSTGRES_TEST) check-doc
$(POSTGRES_TEST) $(POSTGRES_TEST)
clean: clean:
@ -90,4 +75,4 @@ install: $(POSTGRES_LIB)
$(MAKE) -C $(PHF_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR)) $(MAKE) -C $(PHF_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
install $(POSTGRES_LIB) $(INSTALL_DIR) install $(POSTGRES_LIB) $(INSTALL_DIR)
.PHONY: check clean doc install .PHONY: check-doc check clean clean-deps doc install

View File

@ -5,10 +5,9 @@ package.
```rust ```rust
extern crate postgres; extern crate postgres;
extern crate extra; extern crate time;
use extra::time; use time::Timespec;
use extra::time::Timespec;
use postgres::{PostgresConnection, PostgresStatement, NoSsl}; use postgres::{PostgresConnection, PostgresStatement, NoSsl};
use postgres::types::ToSql; use postgres::types::ToSql;
@ -20,6 +19,7 @@ struct Person {
data: Option<~[u8]> data: Option<~[u8]>
} }
# fn main() {
fn main() { fn main() {
let conn = PostgresConnection::connect("postgres://postgres@localhost", let conn = PostgresConnection::connect("postgres://postgres@localhost",
&NoSsl); &NoSsl);
@ -52,6 +52,7 @@ fn main() {
println!("Found person {}", person.name); println!("Found person {}", person.name);
} }
} }
# }
``` ```
*/ */
@ -683,7 +684,7 @@ impl PostgresConnection {
/// ///
/// The URL should be provided in the normal format: /// The URL should be provided in the normal format:
/// ///
/// ``` /// ```notrust
/// postgres://user[:password]@host[:port][/database][?param1=val1[[&param2=val2]...]] /// postgres://user[:password]@host[:port][/database][?param1=val1[[&param2=val2]...]]
/// ``` /// ```
/// ///

View File

@ -472,8 +472,17 @@ impl<'stmt> Iterator<PostgresRow<'stmt>> for PostgresResult<'stmt> {
/// by index is more efficient. Rows are 1-indexed. /// by index is more efficient. Rows are 1-indexed.
/// ///
/// ```rust /// ```rust
/// # extern crate postgres;
/// # use postgres::{PostgresConnection, PostgresStatement, NoSsl};
/// # fn main() {}
/// # fn foo() {
/// # let conn = PostgresConnection::connect("", &NoSsl);
/// # let stmt = conn.prepare("");
/// # let mut result = stmt.query([]);
/// # let row = result.next().unwrap();
/// let foo: i32 = row[1]; /// let foo: i32 = row[1];
/// let bar: ~str = row["bar"]; /// let bar: ~str = row["bar"];
/// # }
/// ``` /// ```
pub struct PostgresRow<'stmt> { pub struct PostgresRow<'stmt> {
priv stmt: &'stmt NormalPostgresStatement<'stmt>, priv stmt: &'stmt NormalPostgresStatement<'stmt>,