Struct glutin_winit::DisplayBuilder

source ·
pub struct DisplayBuilder { /* private fields */ }
Expand description

The helper to perform Display creation and OpenGL platform bootstrapping with the help of winit with little to no platform specific code.

This is only required for the initial setup. If you want to create additional windows just use the finalize_window function and the configuration you’ve used either for the original window or picked with the existing Display.

Implementations§

source§

impl DisplayBuilder

source

pub fn new() -> Self

Create new display builder.

source

pub fn with_preference(self, preference: ApiPreference) -> Self

The preference in picking the configuration.

source

pub fn with_window_attributes( self, window_attributes: Option<WindowAttributes>, ) -> Self

The window attributes to use when building a window.

By default no window is created.

source

pub fn build<Picker>( self, event_loop: &impl GlutinEventLoop, template_builder: ConfigTemplateBuilder, config_picker: Picker, ) -> Result<(Option<Window>, Config), Box<dyn Error>>
where Picker: FnOnce(Box<dyn Iterator<Item = Config> + '_>) -> Config,

Initialize the OpenGL platform and create a compatible window to use with it when the WindowAttributes was passed with Self::with_window_attributes(). It’s optional, since on some platforms like Android it is not available early on, so you want to find configuration and later use it with the finalize_window. But if you don’t care about such platform you can always pass WindowAttributes.

§Api-specific

WGL: - WindowAttributes must be passed in Self::with_window_attributes() if modern OpenGL(ES) is desired, otherwise only builtin functions like glClear will be available.

Trait Implementations§

source§

impl Clone for DisplayBuilder

source§

fn clone(&self) -> DisplayBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DisplayBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DisplayBuilder

source§

fn default() -> DisplayBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,