#[non_exhaustive]pub struct ViewConfig {
pub version: Txt,
pub server_name: Txt,
pub headless: bool,
}Expand description
Configuration for starting a view-process.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.version: TxtThe VERSION of the API crate in the app-process.
server_name: TxtName of the initial channel used in connect_view_process to setup the connections to the
client app-process.
headless: boolIf the server should consider all window requests, headless window requests.
Implementations§
Source§impl ViewConfig
impl ViewConfig
Sourcepub fn new(
version: impl Into<Txt>,
server_name: impl Into<Txt>,
headless: bool,
) -> Self
pub fn new( version: impl Into<Txt>, server_name: impl Into<Txt>, headless: bool, ) -> Self
New config.
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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