HTML custom input with type hidden and number1 min read

I don’t think it is possible to a create an element like

<input type="hidden | number" />

Solution is to create a custom element like this

<hidden-num value="0"></hidden-num>

MDN – Using Custom ELements (

class InputHiddenNum extends HTMLElement {
    constructor() {
    connectedCallback() { = "none";
    get value() {
        return this.intern_value;
    set value(v) {
        this.intern_value = typeof v !== "number" ? parseFloat(v) : v;
        this.setAttribute("value", this.intern_value.toString());

customElements.define("hidden-num", InputHiddenNum);

To add a property of value to our <hidden-num> element, we must add the get value()  and set value(val)  methods.

An attribute of value is also added to element if the value property is changed. A number  value is returned if the elem.value  is accessed.

Custom element is registered with

customElements.define(“hidden-num”, InputHiddenNum);

Built in element can also be extended like

<input is=”hidden-num” />

Refer – MDN – Customized built-in Elements (

RUST: non-exhaustive patterns: `&_` not covered pattern `&_` not covered21 sec read

Tried something like this

let a = "hello";

match a{


non-exhaustive patterns: `&_` not covered pattern `&_` not covered

What I thought was wrong

I thought it meant you cannot match references

What the real error was

Just had to add all possibilities in match statement

let a = "hello";

match a {
    "hello" => println!("helloooooo"),
    _ => println!("blahh blahhh"),


Rust Actix web panic when using custom regex1 min read

Using Actix-web v0.7.4

Error – thread ‘arbiter:6461f87e-20ed-4848-9feb-dbe68ab5ea7e:actor’ panicked at ‘index out of bounds: the len is 1 but the index is 1’, /checkout/src/libcore/slice/

How I corrected it

The loop was accessing an index which didn’t exist. I don’t really know how actix web works or even how Rust works.

pub fn match_with_params  in in actix-web src was the culprit

So I changed the code to this

    /// Are the given path and parameters a match against this resource?
    pub fn match_with_params(&self, req: &Request, plen: usize) -> Option<Params> {
        let path = &req.path()[plen..];

        match {
            PatternType::Static(ref s) => if s != path {
            } else {
            PatternType::Dynamic(ref re, ref names, _) => {
                if let Some(captures) = re.captures(path) {
                    let mut params = Params::with_url(req.url());
                    let mut idx = 0;
                    let mut passed = false;

                    for capture in captures.iter() {
                        if let Some(ref m) = capture {
                            if !passed {
                                passed = true;

                            if idx > names.len() - 1 {

                                    (plen + m.start()) as u16,
                                    (plen + m.end()) as u16,
                            idx += 1;
                    params.set_tail(req.path().len() as u16);
                } else {
            PatternType::Prefix(ref s) => if !path.starts_with(s) {
            } else {