/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use nsstring::nsCString; use std::ffi::c_void;
// Note that we use MaybeString throughout the c++/rust ffi boundary functions // since having a *nsCString to emulate Option<nsCString> (which has no representation on both rust and C++ // operate on the string with common methods like slice() and to_utf8(). // side) doesn't seem to survive crossing the ffi boundary, resulting in a crash when we attempt to // We were getting errors like this: // * Hit MOZ_CRASH(unsafe precondition(s) violated: slice::from_raw_parts requires the pointer // * to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`) // * at core/src/panicking.rs:223 #[derive(Debug, Clone)] #[repr(C)] pubstruct MaybeString { pub string: nsCString, pub valid: bool,
}
// Used as opaque pointer to urlpattern::UrlPattern<R> (lib.rs, not quirks) // this used to hide info of internal urlpattern::url from C++ compiler // so cpp compilation doesn't fail since we don't expose url to gecko #[repr(transparent)] pubstruct UrlPatternGlue(pub *mut c_void);
// opaque pointer to urlpattern::component::Component<SpiderMonkeyRegexp>; #[repr(transparent)] pubstruct UrlPatternComponentPtr(pub *mut c_void);
// opaque pointer to urlpattern::matcher::Matcher<SpiderMonkeyRegexp>; #[repr(transparent)] pubstruct UrlPatternMatcherPtr(pub *mut c_void);
// opaque pointer for passing RegExpObjImpl across ffi API #[repr(transparent)] pubstruct RegExpObjWrapper(pub *mut c_void);
// Note: rust's enum variant do not survive cbindgen's c++ generation because // cbindgen creates a anonymous unions which creates fields that are inaccessible // from caller code on the C++ side. We instead break the variants down into their // own more easily digestable structs so that we can modify them on both sides // of the ffi boundary #[derive(Debug)] #[repr(C)] pubstruct UrlPatternInput { pub string_or_init_type: UrlPatternStringOrInitType, pub str: nsCString, pub init: UrlPatternInit, pub base: MaybeString,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.