Skip to content

Commit

Permalink
Cargo doc auto deployment 2024-05-09 08:54:33.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigocfd committed May 9, 2024
1 parent 2973364 commit 0f4eb56
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 52 deletions.
2 changes: 1 addition & 1 deletion search-index.js

Large diffs are not rendered by default.

50 changes: 40 additions & 10 deletions src/winsafe/kernel/handles/hfile.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,21 @@
<a href="#335" id="335">335</a>
<a href="#336" id="336">336</a>
<a href="#337" id="337">337</a>
<a href="#338" id="338">338</a>
<a href="#339" id="339">339</a>
<a href="#340" id="340">340</a>
<a href="#341" id="341">341</a>
<a href="#342" id="342">342</a>
<a href="#343" id="343">343</a>
<a href="#344" id="344">344</a>
<a href="#345" id="345">345</a>
<a href="#346" id="346">346</a>
<a href="#347" id="347">347</a>
<a href="#348" id="348">348</a>
<a href="#349" id="349">349</a>
<a href="#350" id="350">350</a>
<a href="#351" id="351">351</a>
<a href="#352" id="352">352</a>
</pre></div><pre class="rust"><code><span class="attr">#![allow(non_camel_case_types, non_snake_case)]

</span><span class="kw">use </span><span class="kw">crate</span>::co;
Expand Down Expand Up @@ -494,22 +509,37 @@

<span class="doccomment">/// [`GetFileTime`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletime)
/// function.
</span><span class="kw">fn </span>GetFileTime(<span class="kw-2">&amp;</span><span class="self">self</span>,
creation_time: <span class="prelude-ty">Option</span>&lt;<span class="kw-2">&amp;mut </span>FILETIME&gt;,
last_access_time: <span class="prelude-ty">Option</span>&lt;<span class="kw-2">&amp;mut </span>FILETIME&gt;,
last_write_time: <span class="prelude-ty">Option</span>&lt;<span class="kw-2">&amp;mut </span>FILETIME&gt;,
) -&gt; SysResult&lt;()&gt;
{
///
/// Returns, respectively:
/// 1. creation time;
/// 2. last access time;
/// 3. last write time.
///
/// # Examples
///
/// ```no_run
/// use winsafe::{self as w, prelude::*, co};
///
/// let hfile: w::HFILE; // initialized somewhere
/// # let hfile = w::HFILE::NULL;
///
/// let (creation, last_access, last_write) = hfile.GetFileTime()?;
/// # w::SysResult::Ok(())
/// ```
</span><span class="kw">fn </span>GetFileTime(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; SysResult&lt;(FILETIME, FILETIME, FILETIME)&gt; {
<span class="kw">let </span>(<span class="kw-2">mut </span>creation, <span class="kw-2">mut </span>last_access, <span class="kw-2">mut </span>last_write) =
(FILETIME::default(), FILETIME::default(), FILETIME::default());

bool_to_sysresult(
<span class="kw">unsafe </span>{
ffi::GetFileTime(
<span class="self">self</span>.ptr(),
creation_time.map_or(std::ptr::null_mut(), |p| p <span class="kw">as </span>* <span class="kw-2">mut </span><span class="kw">_ as _</span>),
last_access_time.map_or(std::ptr::null_mut(), |p| p <span class="kw">as </span>* <span class="kw-2">mut </span><span class="kw">_ as _</span>),
last_write_time.map_or(std::ptr::null_mut(), |p| p <span class="kw">as </span>* <span class="kw-2">mut </span><span class="kw">_ as _</span>),
<span class="kw-2">&amp;mut </span>creation <span class="kw">as </span><span class="kw-2">*mut </span><span class="kw">_ as _</span>,
<span class="kw-2">&amp;mut </span>last_access <span class="kw">as </span><span class="kw-2">*mut </span><span class="kw">_ as _</span>,
<span class="kw-2">&amp;mut </span>last_write <span class="kw">as </span><span class="kw-2">*mut </span><span class="kw">_ as _</span>,
)
},
)
).map(|<span class="kw">_</span>| (creation, last_access, last_write))
}

<span class="doccomment">/// [`GetFileType`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletype)
Expand Down
4 changes: 1 addition & 3 deletions src/winsafe/kernel/utilities/file.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
<a href="#198" id="198">198</a>
<a href="#199" id="199">199</a>
<a href="#200" id="200">200</a>
<a href="#201" id="201">201</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::co;
<span class="kw">use </span><span class="kw">crate</span>::decl::<span class="kw-2">*</span>;
<span class="kw">use </span><span class="kw">crate</span>::guard::<span class="kw-2">*</span>;
Expand Down Expand Up @@ -378,8 +377,7 @@
/// time zone.
</span><span class="attr">#[must_use]
</span><span class="kw">pub fn </span>times(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; SysResult&lt;(SYSTEMTIME, SYSTEMTIME)&gt; {
<span class="kw">let </span>(<span class="kw-2">mut </span>ft_creation, <span class="kw-2">mut </span>ft_last_write) = (FILETIME::default(), FILETIME::default());
<span class="self">self</span>.hfile.GetFileTime(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;mut </span>ft_creation), <span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;mut </span>ft_last_write))<span class="question-mark">?</span>;
<span class="kw">let </span>(ft_creation, <span class="kw">_</span>, ft_last_write) = <span class="self">self</span>.hfile.GetFileTime()<span class="question-mark">?</span>;

<span class="kw">let </span>st_creation_utc = FileTimeToSystemTime(<span class="kw-2">&amp;</span>ft_creation)<span class="question-mark">?</span>;
<span class="kw">let </span>st_last_write_utc = FileTimeToSystemTime(<span class="kw-2">&amp;</span>ft_last_write)<span class="question-mark">?</span>;
Expand Down
2 changes: 1 addition & 1 deletion src/winsafe/macros/ffis.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<span class="macro-nonterminal">$func</span>:ident( $( <span class="macro-nonterminal">$parm</span>:ty ),* ) $( -&gt; <span class="macro-nonterminal">$ret</span>:ty )<span class="question-mark">?
</span>)*
) =&gt; {
<span class="attr">#[link(name = <span class="macro-nonterminal">$dll</span>)]
<span class="attr">#[link(name = <span class="macro-nonterminal">$dll</span>, kind = <span class="string">"raw-dylib"</span>)]
</span><span class="kw">extern </span><span class="string">"system" </span>{
$(
<span class="macro">one_func!</span>( <span class="macro-nonterminal">$func</span>( $( <span class="macro-nonterminal">$parm </span>),* ) $(-&gt; <span class="macro-nonterminal">$ret</span>)<span class="question-mark">? </span>);
Expand Down
Loading

0 comments on commit 0f4eb56

Please sign in to comment.