forked from diesel-rs/diesel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrait.ManageConnection.html
More file actions
30 lines (29 loc) · 11.8 KB
/
Copy pathtrait.ManageConnection.html
File metadata and controls
30 lines (29 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A trait which provides connection-specific functionality."><meta name="keywords" content="rust, rustlang, rust-lang, ManageConnection"><title>ManageConnection in r2d2 - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../r2d2/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div>
</a><h2 class="location"></h2>
</nav>
<nav class="sidebar"><a class="sidebar-logo" href="../r2d2/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div>
</a><h2 class="location"><a href="#">ManageConnection</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-associated-types">Required Associated Types</a></h3><ul><li><a href="#associatedtype.Connection">Connection</a></li><li><a href="#associatedtype.Error">Error</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.connect">connect</a></li><li><a href="#tymethod.has_broken">has_broken</a></li><li><a href="#tymethod.is_valid">is_valid</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In r2d2</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../r2d2/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1">
<a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div>
</div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
<h1 class="fqn"><span class="in-band">Trait <a href="index.html">r2d2</a>::<wbr><a class="trait" href="#">ManageConnection</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/r2d2/lib.rs.html#70-96">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait ManageConnection: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static {
type <a href="#associatedtype.Connection" class="associatedtype">Connection</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static;
fn <a href="#tymethod.connect" class="fnname">connect</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Connection" title="type r2d2::ManageConnection::Connection">Connection</a>, Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Error" title="type r2d2::ManageConnection::Error">Error</a>>;
<span class="item-spacer"></span> fn <a href="#tymethod.is_valid" class="fnname">is_valid</a>(&self, conn: &mut Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Connection" title="type r2d2::ManageConnection::Connection">Connection</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Error" title="type r2d2::ManageConnection::Error">Error</a>>;
<span class="item-spacer"></span> fn <a href="#tymethod.has_broken" class="fnname">has_broken</a>(&self, conn: &mut Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Connection" title="type r2d2::ManageConnection::Connection">Connection</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait which provides connection-specific functionality.</p>
</div></details><h2 id="required-associated-types" class="small-section-header">Required Associated Types<a href="#required-associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Connection" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/r2d2/lib.rs.html#72">source</a></div><h4 class="code-header">type <a href="#associatedtype.Connection" class="associatedtype">Connection</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static</h4></div></summary><div class="docblock"><p>The connection type this manager deals with.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/r2d2/lib.rs.html#75">source</a></div><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static</h4></div></summary><div class="docblock"><p>The error type returned by <code>Connection</code>s.</p>
</div></details></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.connect" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/r2d2/lib.rs.html#78">source</a></div><h4 class="code-header">fn <a href="#tymethod.connect" class="fnname">connect</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Connection" title="type r2d2::ManageConnection::Connection">Connection</a>, Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Error" title="type r2d2::ManageConnection::Error">Error</a>></h4></div></summary><div class="docblock"><p>Attempts to create a new connection.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.is_valid" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/r2d2/lib.rs.html#84">source</a></div><h4 class="code-header">fn <a href="#tymethod.is_valid" class="fnname">is_valid</a>(&self, conn: &mut Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Connection" title="type r2d2::ManageConnection::Connection">Connection</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Error" title="type r2d2::ManageConnection::Error">Error</a>></h4></div></summary><div class="docblock"><p>Determines if the connection is still connected to the database.</p>
<p>A standard implementation would check if a simple query like <code>SELECT 1</code>
succeeds.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.has_broken" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/r2d2/lib.rs.html#95">source</a></div><h4 class="code-header">fn <a href="#tymethod.has_broken" class="fnname">has_broken</a>(&self, conn: &mut Self::<a class="associatedtype" href="trait.ManageConnection.html#associatedtype.Connection" title="type r2d2::ManageConnection::Connection">Connection</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p><em>Quickly</em> determines if the connection is no longer usable.</p>
<p>This will be called synchronously every time a connection is returned
to the pool, so it should <em>not</em> block. If it returns <code>true</code>, the
connection will be discarded.</p>
<p>For example, an implementation might check if the underlying TCP socket
has disconnected. Implementations that do not support this kind of
fast health check may simply return <code>false</code>.</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/r2d2/trait.ManageConnection.js" data-ignore-extern-crates="" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="r2d2" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (495b21669 2022-07-03)" ></div>
</body></html>