Struct zng_view_api::ViewConfig
source · pub struct ViewConfig {
pub version: Txt,
pub server_name: Txt,
pub headless: bool,
}Expand description
Configuration for starting a view-process.
Fields§
§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 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 more