[−][src]Struct pcsc::Context
Library context to the PCSC service.
This structure wraps SCARDCONTEXT
.
Methods
impl Context
[src]
pub fn establish(scope: Scope) -> Result<Context, Error>
[src]
pub fn release(self) -> Result<(), (Context, Error)>
[src]
Release the context.
In case of error, ownership of the context is returned to the caller.
This function wraps SCardReleaseContext
(pcsclite,
MSDN).
Note
Context
implements Drop
which automatically releases the
context; you only need to call this function if you want to handle
errors.
If the Context
was cloned, and a clone is still alive, this
function will fail with Error::CantDispose
.
pub fn is_valid(&self) -> Result<(), Error>
[src]
pub fn cancel(&self) -> Result<(), Error>
[src]
Cancel any ongoing blocking operation in the Context.
See the cancel.rs
example program.
pub fn list_readers<'buf>(
&self,
buffer: &'buf mut [u8]
) -> Result<ReaderNames<'buf>, Error>
[src]
&self,
buffer: &'buf mut [u8]
) -> Result<ReaderNames<'buf>, Error>
List all connected card readers.
buffer
is a buffer that should be large enough to hold all of
the connected reader names. The function list_readers_len
can be
used to find the exact required length.
Returns an iterator over the reader names. The iterator yields
values directly from buffer
.
If the buffer is not large enough to hold all of the names,
Error::InsufficientBuffer
is returned.
pub fn list_readers_len(&self) -> Result<usize, Error>
[src]
Get the needed length of a buffer to be passed to list_readers
.
pub fn connect(
&self,
reader: &CStr,
share_mode: ShareMode,
preferred_protocols: Protocols
) -> Result<Card, Error>
[src]
&self,
reader: &CStr,
share_mode: ShareMode,
preferred_protocols: Protocols
) -> Result<Card, Error>
Connect to a card which is present in a reader.
See the connect.rs
example program.
pub fn get_status_change<D>(
&self,
timeout: D,
readers: &mut [ReaderState]
) -> Result<(), Error> where
D: Into<Option<Duration>>,
[src]
&self,
timeout: D,
readers: &mut [ReaderState]
) -> Result<(), Error> where
D: Into<Option<Duration>>,
Wait for card and card reader state changes.
The function blocks until the state of one of the readers changes
from corresponding passed-in ReaderState
. The ReaderState
s are
updated to report the new state.
A special reader name, \\?PnP?\Notification
, can be used to
detect card reader insertions and removals, as opposed to state
changes of a specific reader. Use PNP_NOTIFICATION()
to easily
obtain a static reference to this name.
See the monitor.rs
example program.
Trait Implementations
impl Clone for Context
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Send for Context
[src]
impl Sync for Context
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,