concept rejection sampling in category probabilistic programming

This is an excerpt from Manning's book Practical Probabilistic Programming.
Importance sampling is similar to rejection sampling. In fact, when importance sampling encounters a condition that isn’t satisfied, it rejects the sample, just like rejection sampling. But two major differences exist. First, recall that in addition to conditions, Figaro provides constraints that aren’t just true or false but instead assign a real number to each state. Rejection sampling is unable to handle constraints like this because a sample won’t be completely inconsistent with the evidence, but will just have lower probability. Importance sampling is able to handle constraints, which don’t result in rejection. Second, in the right circumstances, importance sampling can avoid rejecting with conditions by turning the conditions into constraints on other variables.
A simple procedure to do this is called rejection sampling. Rejection sampling uses a simple principle, which is to use forward sampling as before, but reject any samples that disagree with the evidence. Only the samples that are consistent with the evidence are maintained.