Skip to content

Commit 40d5125

Browse files
committed
Re-pub some fields
1 parent 15f7997 commit 40d5125

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

src/lib.rs

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ impl PostgresNoticeHandler for DefaultNoticeHandler {
230230
/// An asynchronous notification
231231
pub struct PostgresNotification {
232232
/// The process ID of the notifying backend process
233-
pid: i32,
233+
pub pid: i32,
234234
/// The name of the channel that the notify has been raised on
235-
channel: ~str,
235+
pub channel: ~str,
236236
/// The "payload" string passed from the notifying process
237-
payload: ~str,
237+
pub payload: ~str,
238238
}
239239

240240
/// An iterator over asynchronous notifications
@@ -257,9 +257,9 @@ impl<'conn> Iterator<PostgresNotification> for PostgresNotifications<'conn> {
257257
/// Contains information necessary to cancel queries for a session
258258
pub struct PostgresCancelData {
259259
/// The process ID of the session
260-
process_id: i32,
260+
pub process_id: i32,
261261
/// The secret key for the session
262-
secret_key: i32,
262+
pub secret_key: i32,
263263
}
264264

265265
/// Attempts to cancel an in-progress query.
@@ -338,10 +338,10 @@ fn initialize_stream(host: &str, port: Port, ssl: &SslMode)
338338
Err(err) => return Err(err)
339339
};
340340

341-
let (ssl_required, ctx) = match ssl {
342-
&NoSsl => return Ok(Normal(socket)),
343-
&PreferSsl(ref ctx) => (false, ctx),
344-
&RequireSsl(ref ctx) => (true, ctx)
341+
let (ssl_required, ctx) = match *ssl {
342+
NoSsl => return Ok(Normal(socket)),
343+
PreferSsl(ref ctx) => (false, ctx),
344+
RequireSsl(ref ctx) => (true, ctx)
345345
};
346346

347347
try_pg_conn!(socket.write_message(&SslRequest { code: message::SSL_CODE }));
@@ -602,12 +602,12 @@ impl InnerPostgresConnection {
602602
let mut result_desc: Vec<ResultDescription> = match try_pg!(self.read_message()) {
603603
RowDescription { descriptions } =>
604604
descriptions.move_iter().map(|desc| {
605-
let RowDescriptionEntry { name, type_oid, .. } = desc;
606-
ResultDescription {
607-
name: name,
608-
ty: PostgresType::from_oid(type_oid)
609-
}
610-
}).collect(),
605+
let RowDescriptionEntry { name, type_oid, .. } = desc;
606+
ResultDescription {
607+
name: name,
608+
ty: PostgresType::from_oid(type_oid)
609+
}
610+
}).collect(),
611611
NoData => Vec::new(),
612612
_ => unreachable!()
613613
};
@@ -645,8 +645,8 @@ impl InnerPostgresConnection {
645645
Some(name) => return Ok(name.clone()),
646646
None => {}
647647
}
648-
let name = try!(self.quick_query(
649-
format!("SELECT typname FROM pg_type WHERE oid={}", oid)))
648+
let name = try!(self.quick_query(format!("SELECT typname FROM pg_type \
649+
WHERE oid={}", oid)))
650650
.move_iter().next().unwrap().move_iter().next().unwrap().unwrap();
651651
self.unknown_types.insert(oid, name.clone());
652652
Ok(name)
@@ -721,8 +721,8 @@ impl PostgresConnection {
721721
/// Err(err) => fail!("Error connecting: {}", err)
722722
/// };
723723
/// ```
724-
pub fn connect(url: &str, ssl: &SslMode)
725-
-> Result<PostgresConnection, PostgresConnectError> {
724+
pub fn connect(url: &str, ssl: &SslMode) -> Result<PostgresConnection,
725+
PostgresConnectError> {
726726
InnerPostgresConnection::connect(url, ssl).map(|conn| {
727727
PostgresConnection {
728728
conn: RefCell::new(conn)
@@ -1293,6 +1293,7 @@ impl<'stmt> PostgresRows<'stmt> {
12931293
///
12941294
/// Functionally identical to the `Drop` implementation on `PostgresRows`
12951295
/// except that it returns any error to the caller.
1296+
#[inline]
12961297
pub fn finish(mut self) -> PostgresResult<()> {
12971298
self.finished = true;
12981299
self.finish_inner()
@@ -1316,11 +1317,13 @@ impl<'stmt> PostgresRows<'stmt> {
13161317
}
13171318

13181319
impl<'stmt> Iterator<PostgresRow<'stmt>> for PostgresRows<'stmt> {
1320+
#[inline]
13191321
fn next(&mut self) -> Option<PostgresRow<'stmt>> {
13201322
// we'll never hit the network on a non-lazy result
13211323
self.try_next().map(|r| r.unwrap())
13221324
}
13231325

1326+
#[inline]
13241327
fn size_hint(&self) -> (uint, Option<uint>) {
13251328
let lower = self.data.len();
13261329
let upper = if self.more_rows {
@@ -1443,17 +1446,20 @@ pub struct PostgresLazyRows<'trans, 'stmt> {
14431446

14441447
impl<'trans, 'stmt> PostgresLazyRows<'trans, 'stmt> {
14451448
/// Like `PostgresRows::finish`.
1449+
#[inline]
14461450
pub fn finish(self) -> PostgresResult<()> {
14471451
self.result.finish()
14481452
}
14491453
}
14501454

14511455
impl<'trans, 'stmt> Iterator<PostgresResult<PostgresRow<'stmt>>>
14521456
for PostgresLazyRows<'trans, 'stmt> {
1457+
#[inline]
14531458
fn next(&mut self) -> Option<PostgresResult<PostgresRow<'stmt>>> {
14541459
self.result.try_next()
14551460
}
14561461

1462+
#[inline]
14571463
fn size_hint(&self) -> (uint, Option<uint>) {
14581464
self.result.size_hint()
14591465
}

0 commit comments

Comments
 (0)