ltk_webkit/types/
navigation.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>

#[ derive( Clone, Copy, Debug, PartialEq, Eq ) ]
pub enum NavigationKind
{
	Link,
	FormSubmission,
	BackForward,
	Reload,
	FormResubmission,
	Other,
}

/// A main-frame navigation about to start.
#[ derive( Clone, Debug ) ]
pub struct Navigation
{
	pub uri:            String,
	/// HTTP method, `GET` unless a form posts.
	pub method:         String,
	pub kind:           NavigationKind,
	pub user_gesture:   bool,
	/// A server redirect of a navigation already under way.
	pub redirect:       bool,
	/// Started by the host through [`crate::WebView::load_uri`], [`crate::WebView::load_html`], [`crate::WebView::reload`] or the history, not by the page.
	pub host_initiated: bool,
}

#[ derive( Clone, Copy, Debug, PartialEq, Eq ) ]
pub enum LoadError
{
	/// Stopped, superseded by another load, or turned down by the navigation handler.
	Cancelled,
	UnsupportedScheme,
	FileNotFound,
	Tls,
	Other,
}

#[ derive( Clone, Debug ) ]
pub enum LoadEvent
{
	Started( String ),
	Redirected( String ),
	Committed( String ),
	/// Also follows a failure.
	Finished( String ),
	Failed { uri: String, error: LoadError, message: String },
}