RDF.Literal.Datatype.do_cast

You're seeing just the callback do_cast, go back to RDF.Literal.Datatype module for more information.

Specs

do_cast(literal() | RDF.IRI.t() | RDF.BlankNode.t()) :: RDF.Literal.t() | nil

Callback for datatype specific castings.

This callback is called by the auto-generated cast/1 function on the implementations, which already deals with the basic cases. So, implementations can assume the passed argument is a valid RDF.Literal.Datatype struct, a RDF.IRI or a RDF.BlankNode.

If the given literal can not be converted into this datatype an implementation should return nil.

A final catch-all clause should delegate to super. For example RDF.XSD.Datatypes will handle casting from derived datatypes in the default implementation.