Function copypasta_ext::try_context[][src]

pub fn try_context() -> Option<Box<dyn ClipboardProvider>>

Try to get clipboard context.

This attempts to obtain a clipboard context suitable for the current environment. This checks at runtime which clipboard contexts are available and which is best suited. If no compatible clipboard context is avaiable, or if initializing a context failed, None is returned.

Note: this function may be used to automatically select an X11 or Wayland clipboard on Unix systems based on the runtime environment.