Skip to content

Adding assertions and documentation for 15 char limiton ty_domain #427

@FelixSelter

Description

@FelixSelter

Hi,
I am new to this and struggled for the past 3 hours trying to find a simple mistake I made.

    const MDNS_SERVICE_NAME: &'static str = "_VERYLONGNAME._tcp.local.";

    let service_info = ServiceInfo::new(
        MDNS_SERVICE_NAME,
        &instance_name,
        &host_name,
        local_ip().map_err(|e| BackendError::new("Could not get local ip", &format!("{}", e)))?,
        MDNS_PORT,
        &MDNS_PROPERTIES[..],
    )

I used a long name inside MDNS_SERVICE_NAME. If this VERYLONGNAME part above is longer than 15 characters nothing will work you wont get any errors and it just silently fails. This is not mentioned in the code of ServiceInfo and not in docs.rs in the example.

I think we should add a comment to the ty_domain property on ServiceInfo, add assertions to verify this inside ServiceInfo::new, also add this in the docstring of new and add information for the module documentation for the example shown on docs.rs

If you confirm I could do that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions