pub struct ViewConfig {
pub version: Txt,
pub server_name: Txt,
pub headless: bool,
}
Expand description
Configuration for starting a view-process.
Fields§
§version: Txt
The VERSION
of the API crate in the app-process.
server_name: Txt
Name of the initial channel used in connect_view_process
to setup the connections to the
client app-process.
headless: bool
If the server should consider all window requests, headless window requests.
Implementations§
source§impl ViewConfig
impl ViewConfig
sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Reads config from environment variables set by the Controller
in a view-process instance.
View API implementers should call this to get the config when it suspects that is running as a view-process.
Returns Some(_)
if the process was initialized as a view-process.
sourcepub fn wait_same_process() -> Self
pub fn wait_same_process() -> Self
Wait for config from same-process.
View API implementers should call this to sign that view-process config should be send to the same process and then start the “app-process” code path in a different thread. This function returns when the app code path sends the “view-process” configuration.
sourcepub fn assert_version(&self, is_same_process: bool)
pub fn assert_version(&self, is_same_process: bool)
Assert that the VERSION
is the same in the app-process and view-process.
This method must be called in the view-process implementation, it fails if the versions don’t match, panics if
is_same_process
or writes to stderr and exits with code .
sourcepub fn is_version_err(exit_code: Option<i32>, stderr: Option<&str>) -> bool
pub fn is_version_err(exit_code: Option<i32>, stderr: Option<&str>) -> bool
Returns true
if a view-process exited because of assert_version
.
Trait Implementations§
source§impl Clone for ViewConfig
impl Clone for ViewConfig
source§fn clone(&self) -> ViewConfig
fn clone(&self) -> ViewConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ViewConfig
impl RefUnwindSafe for ViewConfig
impl Send for ViewConfig
impl Sync for ViewConfig
impl Unpin for ViewConfig
impl UnwindSafe for ViewConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more