MCPcopy Create free account
hub / github.com/audulus/rui / parse_url_query_string

Function parse_url_query_string

src/winit_event_loop.rs:531–545  ·  view source on GitHub ↗

Parse the query string as returned by `web_sys::window()?.location().search()?` and get a specific key out of it.

(query: &'a str, search_key: &str)

Source from the content-addressed store, hash-verified

529/// Parse the query string as returned by `web_sys::window()?.location().search()?` and get a
530/// specific key out of it.
531pub fn parse_url_query_string<'a>(query: &'a str, search_key: &str) -> Option<&'a str> {
532 let query_string = query.strip_prefix('?')?;
533
534 for pair in query_string.split('&') {
535 let mut pair = pair.split('=');
536 let key = pair.next()?;
537 let value = pair.next()?;
538
539 if key == search_key {
540 return Some(value);
541 }
542 }
543
544 None
545}
546
547pub trait Run: View + Sized {
548 fn run(self) {

Callers 1

setupFunction · 0.85

Calls 1

nextMethod · 0.80

Tested by

no test coverage detected